Ok, désolé.
Mod_FearZ.java
| |
| package _fearZ.mod; |
| |
| import org.lwjgl.util.glu.Registry; |
| |
| import net.minecraft.block.Block; |
| import net.minecraft.block.BlockChest; |
| import net.minecraft.block.material.Material; |
| import net.minecraft.creativetab.CreativeTabs; |
| import _fearZ.mod.common.CommonProxy; |
| import cpw.mods.fml.common.Mod; |
| import cpw.mods.fml.common.Mod.EventHandler; |
| import cpw.mods.fml.common.Mod.Init; |
| import cpw.mods.fml.common.Mod.Instance; |
| import cpw.mods.fml.common.Mod.PreInit; |
| 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; |
| import cpw.mods.fml.common.registry.GameRegistry; |
| import cpw.mods.fml.common.registry.LanguageRegistry; |
| |
| @Mod(modid = "fearz", name = "FearZ", version = "1.0.0") |
| @NetworkMod(clientSideRequired = true, serverSideRequired = true) |
| |
| public class Mod_FearZ |
| { |
| @Instance("FearZMod") |
| public static Mod_FearZ modInstance; |
| @SidedProxy(clientSide="_fearZ.mod.client.ClientProxy", serverSide="_fearZ.mod.common.CommonProxy") |
| public static CommonProxy proxy; |
| |
| |
| public static Block armoirePh; |
| |
| |
| |
| |
| public static final CreativeTabs onglet = new OngletCreatif(CreativeTabs.getNextID(), "FearZ"); |
| |
| @EventHandler |
| public void PreInit(FMLPreInitializationEvent event) |
| { |
| |
| Block armoirePh = new BlockPharmacie (1800).setBlockUnbreakable().setHardness(10000f).setStepSound(Block.soundMetalFootstep).setUnlocalizedName("ArmoirePharmacie"); |
| GameRegistry.registerBlock(armoirePh, "armoirePh"); |
| |
| } |
| |
| @EventHandler |
| public void Init(FMLInitializationEvent event) |
| { |
| |
| |
| |
| proxy.registerRender(); |
| proxy.registerTileEntityRender(); |
| |
| |
| |
| |
| |
| |
| GameRegistry.registerTileEntity(TileEntityArmoirePh.class, "pharmacie"); |
| |
| } |
| |
| @EventHandler |
| public void PostInit(FMLPostInitializationEvent event) |
| { |
| |
| } |
| } |
| |
ClientProxy.java
| |
| package _fearZ.mod.client; |
| |
| import cpw.mods.fml.client.registry.ClientRegistry; |
| import cpw.mods.fml.client.registry.RenderingRegistry; |
| import _fearZ.mod.Mod_FearZ; |
| import _fearZ.mod.TileEntityArmoirePh; |
| import _fearZ.mod.client.TESRInventoryRenderer.TESRIndex; |
| import _fearZ.mod.common.CommonProxy; |
| |
| public class ClientProxy extends CommonProxy |
| { |
| public static int renderInventoryTESRId; |
| @Override |
| public void registerRender() |
| { |
| renderInventoryTESRId = RenderingRegistry.getNextAvailableRenderId(); |
| RenderingRegistry.registerBlockHandler(new TESRInventoryRenderer()); |
| } |
| |
| @Override |
| public void registerTileEntityRender() |
| { |
| ClientRegistry.bindTileEntitySpecialRenderer(TileEntityArmoirePh.class, new TileEntityArmoirePhSpecialRender()); |
| TESRInventoryRenderer.blockByTESR.put(new TESRIndex(Mod_FearZ.armoirePh, 0), new TileEntityArmoirePhSpecialRender()); |
| } |
| } |
| |
TESRInventoryRenderer
| |
| package _fearZ.mod.client; |
| |
| import java.util.HashMap; |
| |
| import _fearZ.mod.IInventoryRenderer; |
| import net.minecraft.block.Block; |
| import net.minecraft.client.renderer.RenderBlocks; |
| import net.minecraft.world.IBlockAccess; |
| import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; |
| |
| public class TESRInventoryRenderer implements ISimpleBlockRenderingHandler |
| { |
| public static class TESRIndex |
| { |
| Block block; |
| int metadata; |
| |
| public TESRIndex (Block block, int metadata) |
| { |
| this.block = block; |
| this.metadata = metadata; |
| } |
| |
| @Override |
| public int hashCode() |
| { |
| return block.hashCode() + metadata; |
| } |
| |
| @Override |
| public boolean equals(Object o) |
| { |
| if (!(o instanceof TESRIndex)) |
| { |
| return false; |
| } |
| TESRIndex tesr = (TESRIndex)o; |
| return tesr.block == block && tesr.metadata == metadata; |
| } |
| } |
| public static HashMap <tesrindex, iinventoryrenderer="">blockByTESR = new HashMap <tesrindex, iinventoryrenderer="">(); |
| |
| @Override |
| public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) |
| { |
| TESRIndex index = new TESRIndex(block, metadata); |
| if(blockByTESR.containsKey(index)) |
| { |
| blockByTESR.get(index).renderInventory(-0.5, -0.5, -0.5); |
| } |
| } |
| |
| @Override |
| public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) |
| { |
| return true; |
| |
| } |
| |
| @Override |
| public boolean shouldRender3DInInventory() |
| { |
| return true; |
| |
| } |
| |
| @Override |
| public int getRenderId() |
| { |
| return ClientProxy.renderInventoryTESRId; |
| |
| } |
| } |
| |
| ```</tesrindex,></tesrindex,> |