Flaghacker

learning.java

Aug 23rd, 2014
362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.47 KB | None | 0 0
  1. package net.flaghacker.learning;
  2.  
  3. import net.minecraft.block.Block;
  4. import net.minecraft.creativetab.CreativeTabs;
  5. import net.minecraft.init.Items;
  6. import net.minecraft.item.Item;
  7. import cpw.mods.fml.common.Mod;
  8. import cpw.mods.fml.common.Mod.EventHandler;
  9. import cpw.mods.fml.common.event.FMLInitializationEvent;
  10. import cpw.mods.fml.common.event.FMLPreInitializationEvent;
  11. import cpw.mods.fml.common.registry.GameRegistry;
  12.  
  13. //Initialize mod with variables MODID and VERSION
  14. @Mod(modid = learning.MODID, version = learning.VERSION)
  15.  
  16. public class learning {
  17.     public static final String MODID = "learning";
  18.     public static final String VERSION = "0.0";
  19.    
  20.     //Variable declarations
  21.     public static Block block1;
  22.     public static Item item1;
  23.    
  24.     //Adding a creative tab
  25.     public static CreativeTabs tab1 = new CreativeTabs(MODID + " 1") {
  26.         public Item getTabIconItem() {
  27.             //Icon
  28.             return Items.emerald;
  29.         }
  30.     };
  31.    
  32.     @EventHandler
  33.     public void preInit(FMLPreInitializationEvent event) {
  34.         //Create block
  35.         block1 = new Block1();
  36.         block1.setBlockName("block 1");
  37.         block1.setCreativeTab(tab1);
  38.         block1.setBlockTextureName(MODID + ":" + "block1.png");
  39.         //Add to game
  40.         GameRegistry.registerBlock(block1, "block 1");
  41.        
  42.         //Create Item
  43.         item1 = new Item();
  44.         item1.setUnlocalizedName("item 1");
  45.         item1.setCreativeTab(tab1);
  46.         //Add to game
  47.         GameRegistry.registerItem(item1, "item 1");
  48.     }
  49.    
  50.     @EventHandler
  51.     public void init(FMLInitializationEvent event) {
  52.        
  53.     }
  54. }
Add Comment
Please, Sign In to add comment