Classe principale :
package fr.mrazerty31.IHC4;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSeeds;
import net.minecraft.item.ItemStack;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraftforge.common.ChestGenHooks;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
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.registry.GameRegistry;
import fr.mrazerty31.IHC4.proxy.CommonProxy;
@Mod(modid = IHC4.MODID, name = "IHC4 Mod", version = IHC4.VERSION)
public class IHC4
{
public static final String MODID = "ihc4mod";
public static final String VERSION = "1.0";
public static IHC4 instance;
@SidedProxy(clientSide = "fr.mrazerty31.IHC4.proxy.ClientProxy", serverSide = "fr.mrazerty31.IHC4.proxy.CommonProxy")
public static CommonProxy proxy;
/* Déclaration des Items */
public static Item berry, ironBerry, goldenBerry, berrySeeds;
/* Déclaration des Blocks */
public static Block blockBerry;
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
berry = new Berry(1, 0.3F, false).setUnlocalizedName("berry").setTextureName("ihc4mod:berry");
ironBerry = new IronBerry(1, 0.3F, false).setUnlocalizedName("iron_berry").setTextureName("ihc4mod:berry_iron");
goldenBerry = new GoldBerry(1, 0.3F, false).setUnlocalizedName("golden_berry").setTextureName("ihc4mod:berry_gold");
berrySeeds = new ItemSeeds(blockBerry, Blocks.farmland).setUnlocalizedName("berry_seeds").setTextureName("ihc4mod:berry_seeds").setCreativeTab(CreativeTabs.tabMaterials);
blockBerry = new BlockBerryPlant().setBlockName("block_berry");
}
@EventHandler
public void init(FMLInitializationEvent event)
{
GameRegistry.registerItem(berry, "berry");
GameRegistry.registerItem(ironBerry, "iron_berry");
GameRegistry.registerItem(goldenBerry, "golden_berry");
GameRegistry.registerItem(berrySeeds, "berry_seeds");
GameRegistry.registerBlock(blockBerry, "block_berry");
ChestGenHooks.addItem(ChestGenHooks.MINESHAFT_CORRIDOR, new WeightedRandomChestContent(berry, 0, 0, 4, 10));
proxy.registerRender();
}
@EventHandler
public void postInit(FMLPostInitializationEvent event)
{
GameRegistry.addRecipe(new ItemStack(ironBerry), "ib", 'i', Blocks.iron_block, 'b', berry);
GameRegistry.addRecipe(new ItemStack(goldenBerry), " g ", "gbg", " g ", 'g', Items.gold_ingot, 'b', berry);
}
}
Merci de vos réponses