Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.flaghacker.learning;
- import net.minecraft.block.Block;
- import net.minecraft.creativetab.CreativeTabs;
- import net.minecraft.init.Items;
- import net.minecraft.item.Item;
- import cpw.mods.fml.common.Mod;
- import cpw.mods.fml.common.Mod.EventHandler;
- import cpw.mods.fml.common.event.FMLInitializationEvent;
- import cpw.mods.fml.common.event.FMLPreInitializationEvent;
- import cpw.mods.fml.common.registry.GameRegistry;
- //Initialize mod with variables MODID and VERSION
- @Mod(modid = learning.MODID, version = learning.VERSION)
- public class learning {
- public static final String MODID = "learning";
- public static final String VERSION = "0.0";
- //Variable declarations
- public static Block block1;
- public static Item item1;
- //Adding a creative tab
- public static CreativeTabs tab1 = new CreativeTabs(MODID + " 1") {
- public Item getTabIconItem() {
- //Icon
- return Items.emerald;
- }
- };
- @EventHandler
- public void preInit(FMLPreInitializationEvent event) {
- //Create block
- block1 = new Block1();
- block1.setBlockName("block 1");
- block1.setCreativeTab(tab1);
- block1.setBlockTextureName(MODID + ":" + "block1.png");
- //Add to game
- GameRegistry.registerBlock(block1, "block 1");
- //Create Item
- item1 = new Item();
- item1.setUnlocalizedName("item 1");
- item1.setCreativeTab(tab1);
- //Add to game
- GameRegistry.registerItem(item1, "item 1");
- }
- @EventHandler
- public void init(FMLInitializationEvent event) {
- }
- }
Add Comment
Please, Sign In to add comment