Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package tutorial.generic;
- import net.minecraft.block.Block;
- import net.minecraft.block.BlockContainer;
- import net.minecraft.block.material.Material;
- import net.minecraft.client.gui.Gui;
- import net.minecraft.client.particle.EntityFX;
- import net.minecraft.creativetab.CreativeTabs;
- import net.minecraft.init.Blocks;
- import net.minecraft.init.Items;
- import net.minecraft.inventory.Container;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemBlock;
- import net.minecraft.item.ItemStack;
- import net.minecraft.item.crafting.FurnaceRecipes;
- import net.minecraft.tileentity.TileEntity;
- import cpw.mods.fml.common.Mod;
- import cpw.mods.fml.common.Mod.EventHandler; // used in 1.6.2
- //import cpw.mods.fml.common.Mod.PreInit; // used in 1.5.2
- //import cpw.mods.fml.common.Mod.Init; // used in 1.5.2
- //import cpw.mods.fml.common.Mod.PostInit; // used in 1.5.2
- import cpw.mods.fml.common.Mod.Instance;
- import cpw.mods.fml.common.SidedProxy;
- import cpw.mods.fml.common.event.FMLInitializationEvent;
- import cpw.mods.fml.common.event.FMLPostInitializationEvent;
- import cpw.mods.fml.common.event.FMLPreInitializationEvent;
- //import cpw.mods.fml.common.network.NetworkMod; // not used in 1.7
- import cpw.mods.fml.common.registry.GameRegistry;
- import cpw.mods.fml.common.network.NetworkRegistry;
- @Mod(modid = "Generic", name = "Generic", version = "0.0.0")
- // @NetworkMod(clientSideRequired=true) // not used in 1.7
- public class Generic {
- public static Item genericItem;
- public static Item genericIngot;
- public static Block genericDirt;
- public static Block genericOre;
- public static Block enderSapling;
- public static Block enderPlanks;
- public static Block enderTreeLog;
- public static Block enderTreeLeaves;
- public static Block enderCrop;
- public static Block enderFurnaceLit;
- public static Block enderFurnaceUnlit;
- public static TileEntity tileEntityEnderFurnace;
- public static Block enderCraftingTable;
- public static Item enderSeeds;
- // The instance of your mod that Forge uses.
- @Instance(value = "Generic")
- public static Generic instance;
- // Says where the client and server 'proxy' code is loaded.
- @SidedProxy(clientSide = "tutorial.generic.client.ClientProxy", serverSide = "tutorial.generic.CommonProxy")
- public static CommonProxy proxy;
- @EventHandler
- // used in 1.6.2
- // @PreInit // used in 1.5.2
- public void preInit(FMLPreInitializationEvent event) {
- // .setBlockTextureName("generic:genericBlock");
- genericItem = new GenericItem()
- .setTextureName("genericmod:genericItem");
- genericIngot = new GenericItem().setMaxStackSize(64)
- .setUnlocalizedName("genericIngot")
- .setTextureName("genericmod:genericIngot");
- genericDirt = new GenericBlock(Material.ground)
- .setBlockName("genericDirt").setHardness(.2F)
- .setStepSound(Block.soundTypeGravel)
- .setBlockTextureName("genericmod:genericBlock");
- genericOre = new GenericOre(Material.rock)
- .setBlockTextureName("genericmod:genericOre");
- enderSapling = new EnderSapling().setBlockName("enderSapling")
- .setHardness(0F).setBlockTextureName("endermod:enderSapling");
- enderPlanks = new EnderPlanks().setBlockName("enderPlanks")
- .setHardness(2F).setBlockTextureName("endermod:enderPlanks");
- enderCrop = new EnderCrop().setBlockName("enderCrop")
- .setBlockTextureName("endermod:enderCrop");
- enderSeeds = new EnderSeeds(Generic.enderCrop, Blocks.farmland)
- .setTextureName("endermod:enderSeeds").setUnlocalizedName(
- "enderSeeds");
- enderFurnaceLit = new EnderFurnace(true).setHardness(2F).setBlockName(
- "enderFurnaceLit");
- enderFurnaceUnlit = new EnderFurnace(false).setHardness(2F)
- .setBlockName("enderFurnaceUnlit")
- .setCreativeTab(CreativeTabs.tabMisc);
- tileEntityEnderFurnace = new TileEntityEnderFurnace();
- enderCraftingTable = new EnderCraftingTable().setHardness(2F)
- .setBlockName("enderCraftingTable")
- .setBlockTextureName("endermod:crafting_table");
- // The second parameter is an unique registry identifier (not the
- // displayed name)
- // Please don't use item1.getUnlocalizedName(), or you will make Lex sad
- // GameRegistry.registerBlock(enderSapling,"enderSapling");
- // GameRegistry.registerBlock(enderTreeLog,"enderTreeLog");
- // GameRegistry.registerBlock(enderTreeLeaves,"enderTreeLeaves");
- GameRegistry.registerItem(genericItem, "genericItem");
- GameRegistry.registerItem(genericIngot, "genericIngot");
- GameRegistry.registerBlock(genericDirt, "genericDirt");
- GameRegistry.registerBlock(genericOre, "genericOre");
- GameRegistry.registerItem(enderSeeds, "enderSeeds");
- GameRegistry.registerBlock(enderCrop, "enderCrop");
- GameRegistry.registerBlock(enderPlanks, "enderPlanks");
- GameRegistry.registerBlock(enderFurnaceUnlit, "enderFurnaceUnlit");
- GameRegistry.registerBlock(enderFurnaceLit, "enderFurnaceLit");
- GameRegistry.registerTileEntity(TileEntityEnderFurnace.class,
- "tileEntityEnderFurnace");
- // GameRegistry.registerBlock(enderCraftingTable, "enderCraftingTable");
- // Recipes
- // GameRegistry.addRecipe(new ItemStack(Items.diamond, 64), new
- // ItemStack(Blocks.dirt));
- /*
- * ItemStack dirtStack = new ItemStack(Blocks.dirt); ItemStack
- * gravelStack = new ItemStack(Blocks.gravel); ItemStack cobbleStack =
- * new ItemStack(Blocks.cobblestone);
- * GameRegistry.addShapelessRecipe(new ItemStack(Items.diamond, 64),
- * dirtStack, dirtStack, dirtStack, dirtStack, dirtStack, dirtStack, new
- * ItemStack(Blocks.sand), gravelStack, cobbleStack);
- */
- ItemStack brickstack = new ItemStack(Blocks.nether_brick);
- ItemStack netherstack = new ItemStack(Blocks.netherrack);
- // GameRegistry.addShapedRecipe(new
- // ItemStack(Blocks.nether_brick),"xxx","xxx","xxx", 'x', brickstack);
- GameRegistry.addShapedRecipe(brickstack, new Object[] { "x x", "x x",
- "x x", 'x', brickstack });
- // Note not only Block -> Blocks but stoneBrick -> stonebrick
- GameRegistry.addSmelting(Blocks.stone,
- new ItemStack(Blocks.stonebrick), 0.1f);
- // For smelting items with metadata
- /*
- * ItemStack woolStackBlack = new ItemStack(Blocks.wool); ItemStack
- * woolStackWhite = new ItemStack(Blocks.wool);
- * woolStackBlack.setItemDamage(15); woolStackWhite.setItemDamage(1);
- * GameRegistry.addSmelting(woolStackBlack, woolStackWhite, 0.1f);
- */
- }
- @EventHandler
- // used in 1.6.2
- // @Init // used in 1.5.2
- public void load(FMLInitializationEvent event) {
- proxy.registerRenderers();
- ;
- NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler()); // new
- // GuiHandler());
- }
- @EventHandler
- // used in 1.6.2
- // @PostInit // used in 1.5.2
- public void postInit(FMLPostInitializationEvent event) {
- // Stub Method
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment