Résolu [Forge 1492] TileEntitySpecialRenderer (Texture)
-
Regarde donc si ton TESR est enregistré (toujours en mettant des logs), si la méthode renderTileEntityAt est appelée etc et remonte jusqu’au problème
-
je comprend pas car mon model 3D fonctionne, il est rendu en jeux sauf la texture
-
Ton model n’est pas rendu si ta méthode n’est pas appelée
-
ba en jeux il est rendu apres peut etre que le System.out.println ne sais pas affiché.
Il y a que la texture qui n’est pas rendu en jeux c’est ca mon gros problèmeholala j’y comprend plus rien
-
Le code pour le rendu dans l’inventaire n’est pas au bon endroit. Vérifies aussi que ton tile entity est bien enregistré.
-
oui mon TileEntity est bien enregistrer dans ma class principale
-
J’ai suivi de nouveau le tuto du forum entier, ca ne foncionne toujours pas.
J’ai que mon model tesr qui est rendu et pas la texture.Cella peut-il est du a la version de forge que j’utilise ?(Forge 1492)
-
Envoi :
- classe principale
- client proxy
- TESR
- block
-
Class Princ. :
package com.SpyMan.TinkerCraft; import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; import net.minecraft.util.ResourceLocation; import net.minecraftforge.oredict.OreDictionary; import com.SpyMan.TinkerCraft.Blocks.Lantern.Lantern; import com.SpyMan.TinkerCraft.Blocks.Lantern.TileLantern; import com.SpyMan.TinkerCraft.Items.DiamAxeHead; import com.SpyMan.TinkerCraft.Items.DiamPickHead; import com.SpyMan.TinkerCraft.Items.DiamShovelHead; import com.SpyMan.TinkerCraft.Items.GoldAxeHead; import com.SpyMan.TinkerCraft.Items.GoldPickHead; import com.SpyMan.TinkerCraft.Items.GoldShovelHead; import com.SpyMan.TinkerCraft.Items.IronAxeHead; import com.SpyMan.TinkerCraft.Items.IronPickHead; import com.SpyMan.TinkerCraft.Items.IronShovelHead; import com.SpyMan.TinkerCraft.Items.StoneAxeHead; import com.SpyMan.TinkerCraft.Items.StonePickHead; import com.SpyMan.TinkerCraft.Items.StoneShovelHead; import com.SpyMan.TinkerCraft.Items.WoodAxeHead; import com.SpyMan.TinkerCraft.Items.WoodPickHead; import com.SpyMan.TinkerCraft.Items.WoodShovelHead; import com.SpyMan.TinkerCraft.ItemsTools.DiamChisel; import com.SpyMan.TinkerCraft.ItemsTools.DiamHammer; import com.SpyMan.TinkerCraft.ItemsTools.DiamSaw; import com.SpyMan.TinkerCraft.ItemsTools.IronChisel; import com.SpyMan.TinkerCraft.ItemsTools.IronHammer; import com.SpyMan.TinkerCraft.ItemsTools.IronSaw; import com.SpyMan.TinkerCraft.ItemsTools.StoneChisel; import com.SpyMan.TinkerCraft.ItemsTools.StoneHammer; import com.SpyMan.TinkerCraft.ItemsTools.StoneSaw; import com.SpyMan.TinkerCraft.ItemsTools.WoodSaw; import com.SpyMan.TinkerCraft.ItemsTools.Wrench; import com.SpyMan.TinkerCraft.proxy.CommonProxy; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; 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.registry.GameRegistry; @Mod(modid = "TinkerCraft", name = "TinkerCraft", version = "1.0.0") public class MainClass { @Instance("TinkerCraft") public static MainClass instance; @SidedProxy(clientSide = "com.SpyMan.TinkerCraft.proxy.ClientProxy", serverSide = "com.SpyMan.TinkerCraft.proxy.CommonProxy") public static CommonProxy proxy; public static final String MODID = "TinkerCraft"; public static final String VERSION = "1.0"; /* CreativeTabs */ public static CreativeTabs modTab = new mTab("mTab"); /* Blocks */ public static Block lantern; /* Items */ public static Item not_available; /* Items Tools */ public static Item ironHammer, diamHammer, stoneSaw, stoneHammer, wrench, woodSaw, ironSaw, diamSaw; public static Item stoneChisel, ironChisel, diamChisel; /* Tools Parts */ public static Item woodPickHead, stonePickHead, goldPickHead, ironPickHead, diamPickHead; public static Item woodShovelHead, stoneShovelHead, goldShovelHead, ironShovelHead, diamShovelHead; public static Item woodAxeHead, stoneAxeHead, goldAxeHead, ironAxeHead, diamAxeHead; /* Remove Recipes */ public static void removeRecipe(ItemStack stack) { List <irecipe>recipeList = CraftingManager.getInstance().getRecipeList(); for(int i = 0; i < recipeList.size(); i++) { ItemStack output = recipeList.get(i).getRecipeOutput(); if(output != null && stack.getItem() == output.getItem() && stack.getItemDamage() == output.getItemDamage()) { recipeList.remove(i); } } } @EventHandler public void preInit(FMLPreInitializationEvent event) { /* -=[ Block Lantern ]=- */ lantern = new Lantern().setBlockName("lantern").setCreativeTab(modTab).setBlockTextureName(MODID+":lantern"); /* -=[ Items ]=- */ ironHammer = new IronHammer().setUnlocalizedName("ironHammer").setTextureName(MODID+":ironHammer").setCreativeTab(modTab); diamHammer = new DiamHammer().setUnlocalizedName("diamHammer").setTextureName(MODID+":diamHammer").setCreativeTab(modTab); stoneHammer = new StoneHammer().setUnlocalizedName("stoneHammer").setTextureName(MODID+":stoneHammer").setCreativeTab(modTab); wrench = new Wrench().setUnlocalizedName("Wrench").setTextureName(MODID+":wrench").setCreativeTab(modTab); woodSaw = new WoodSaw().setUnlocalizedName("woodSaw").setTextureName(MODID+":woodSaw").setCreativeTab(modTab); ironSaw = new IronSaw().setUnlocalizedName("ironSaw").setTextureName(MODID+":ironSaw").setCreativeTab(modTab); diamSaw = new DiamSaw().setUnlocalizedName("diamSaw").setTextureName(MODID+":diamSaw").setCreativeTab(modTab); stoneSaw = new StoneSaw().setUnlocalizedName("stoneSaw").setTextureName(MODID+":stoneSaw").setCreativeTab(modTab); stoneChisel = new StoneChisel().setUnlocalizedName("stoneChisel").setTextureName(MODID+":stoneChisel").setCreativeTab(modTab); diamChisel = new DiamChisel().setUnlocalizedName("diamChisel").setTextureName(MODID+":diamChisel").setCreativeTab(modTab); ironChisel = new IronChisel().setUnlocalizedName("ironChisel").setTextureName(MODID+":ironChisel").setCreativeTab(modTab); woodPickHead = new WoodPickHead().setUnlocalizedName("woodPickHead").setTextureName(MODID+":woodPickHead").setCreativeTab(modTab); stonePickHead = new StonePickHead().setUnlocalizedName("stonePickHead").setTextureName(MODID+":stonePickHead").setCreativeTab(modTab); goldPickHead = new GoldPickHead().setUnlocalizedName("goldPickHead").setTextureName(MODID+":goldPickHead").setCreativeTab(modTab); ironPickHead = new IronPickHead().setUnlocalizedName("ironPickHead").setTextureName(MODID+":ironPickHead").setCreativeTab(modTab); diamPickHead = new DiamPickHead().setUnlocalizedName("diamPickHead").setTextureName(MODID+":diamPickHead").setCreativeTab(modTab); woodShovelHead = new WoodShovelHead().setUnlocalizedName("woodShovelHead").setTextureName(MODID+":woodShovelHead").setCreativeTab(modTab); stoneShovelHead = new StoneShovelHead().setUnlocalizedName("stoneShovelHead").setTextureName(MODID+":stoneShovelHead").setCreativeTab(modTab); goldShovelHead = new GoldShovelHead().setUnlocalizedName("goldShovelHead").setTextureName(MODID+":goldShovelHead").setCreativeTab(modTab); ironShovelHead = new IronShovelHead().setUnlocalizedName("ironShovelHead").setTextureName(MODID+":ironShovelHead").setCreativeTab(modTab); diamShovelHead = new DiamShovelHead().setUnlocalizedName("diamShovelHead").setTextureName(MODID+":diamShovelHead").setCreativeTab(modTab); woodAxeHead = new WoodAxeHead().setUnlocalizedName("woodAxeHead").setTextureName(MODID+":woodAxeHead").setCreativeTab(modTab); stoneAxeHead = new StoneAxeHead().setUnlocalizedName("stoneAxeHead").setTextureName(MODID+":stoneAxeHead").setCreativeTab(modTab); goldAxeHead = new GoldAxeHead().setUnlocalizedName("goldAxeHead").setTextureName(MODID+":goldAxeHead").setCreativeTab(modTab); ironAxeHead = new IronAxeHead().setUnlocalizedName("ironAxeHead").setTextureName(MODID+":ironAxeHead").setCreativeTab(modTab); diamAxeHead = new DiamAxeHead().setUnlocalizedName("diamAxeHead").setTextureName(MODID+":diamAxeHead").setCreativeTab(modTab); /* Item Register */ GameRegistry.registerItem(diamAxeHead, "diamAxeHead"); GameRegistry.registerItem(goldAxeHead, "goldAxeHead"); GameRegistry.registerItem(ironAxeHead, "ironAxeHead"); GameRegistry.registerItem(woodAxeHead, "woodAxeHead"); GameRegistry.registerItem(stoneAxeHead, "stoneAxeHead"); GameRegistry.registerItem(diamPickHead, "diamPickHead"); GameRegistry.registerItem(goldPickHead, "goldPickHead"); GameRegistry.registerItem(stonePickHead, "stonePickHead"); GameRegistry.registerItem(woodPickHead, "woodPickHead"); GameRegistry.registerItem(ironPickHead, "ironPickHead"); GameRegistry.registerItem(diamShovelHead, "diamShovelHead"); GameRegistry.registerItem(goldShovelHead, "goldShovelHead"); GameRegistry.registerItem(stoneShovelHead, "stoneShovelHead"); GameRegistry.registerItem(woodShovelHead, "woodShovelHead"); GameRegistry.registerItem(ironShovelHead, "ironShovelHead"); GameRegistry.registerItem(ironSaw, "ironSaw"); GameRegistry.registerItem(woodSaw, "woodSaw"); GameRegistry.registerItem(diamSaw, "diamSaw"); GameRegistry.registerItem(stoneSaw, "stoneSaw"); GameRegistry.registerItem(ironHammer, "ironHammer"); GameRegistry.registerItem(diamHammer, "diamHammer"); GameRegistry.registerItem(stoneHammer, "stoneHammer"); GameRegistry.registerItem(ironChisel, "ironChisel"); GameRegistry.registerItem(diamChisel, "diamChisel"); GameRegistry.registerItem(stoneChisel, "stoneChisel"); GameRegistry.registerItem(wrench, "wrench"); GameRegistry.registerBlock(lantern, "lantern"); GameRegistry.registerTileEntity(TileLantern.class, "TileLantern"); /* Remove Recipes */ removeRecipe(new ItemStack(Items.diamond_pickaxe)); removeRecipe(new ItemStack(Items.diamond_axe)); removeRecipe(new ItemStack(Items.diamond_shovel)); removeRecipe(new ItemStack(Items.iron_pickaxe)); removeRecipe(new ItemStack(Items.iron_axe)); removeRecipe(new ItemStack(Items.iron_shovel)); removeRecipe(new ItemStack(Items.golden_pickaxe)); removeRecipe(new ItemStack(Items.golden_axe)); removeRecipe(new ItemStack(Items.golden_shovel)); removeRecipe(new ItemStack(Items.stone_pickaxe)); removeRecipe(new ItemStack(Items.stone_axe)); removeRecipe(new ItemStack(Items.stone_shovel)); removeRecipe(new ItemStack(Items.wooden_pickaxe)); removeRecipe(new ItemStack(Items.wooden_axe)); removeRecipe(new ItemStack(Items.wooden_shovel)); /* -=[ Recipes ]=- */ /* Recipe Lantern */ // GameRegistry.addRecipe(new ItemStack(lantern, 1, 0), new Object[] // { // "ISI", // "GTG", // "ISI", // 'T', new ItemStack(Blocks.torch, 1, 0), // 'I', new ItemStack(Items.iron_ingot, 1, 0), // 'S', new ItemStack(Blocks.stone, 1, 0), // 'G', new ItemStack(Blocks.glass_pane, 1, 0) // }); /* -=[ Recipes Saws ]=- */ GameRegistry.addRecipe(new ItemStack(woodSaw, 1, 0), new Object[] { "#00", "0#0", "00#", '#', new ItemStack(Blocks.planks, 1, OreDictionary.WILDCARD_VALUE) }); GameRegistry.addRecipe(new ItemStack(stoneSaw, 1, 0), new Object[] { "I00", "0I0", "00#", '#', new ItemStack(Blocks.planks, 1, OreDictionary.WILDCARD_VALUE), 'I', Blocks.cobblestone }); GameRegistry.addRecipe(new ItemStack(ironSaw, 1, 0), new Object[] { "I00", "0I0", "00#", '#', new ItemStack(Blocks.planks, 1, OreDictionary.WILDCARD_VALUE), 'I', Items.iron_ingot }); GameRegistry.addRecipe(new ItemStack(diamSaw, 1, 0), new Object[] { "I00", "0I0", "00#", '#', new ItemStack(Blocks.planks, 1, OreDictionary.WILDCARD_VALUE), 'I', Items.diamond }); /* -=[ Recipes Hammers ]=- */ GameRegistry.addRecipe(new ItemStack(stoneHammer, 1, 0), new Object[] { "III", "III", " # ", '#', Items.stick, 'I', Blocks.cobblestone }); GameRegistry.addRecipe(new ItemStack(ironHammer, 1, 0), new Object[] { "III", "III", "0#0", '#', Items.stick, 'I', Items.iron_ingot }); GameRegistry.addRecipe(new ItemStack(diamHammer, 1, 0), new Object[] { "III", "III", "0#0", '#', Items.stick, 'I', Items.diamond }); /* -=[ Recipes Chisels ]=- */ GameRegistry.addRecipe(new ItemStack(ironChisel, 1, 0), new Object[] { "I00", "0I0", "00#", '#', Items.stick, 'I', Items.iron_ingot }); GameRegistry.addRecipe(new ItemStack(diamChisel, 1, 0), new Object[] { "I00", "0I0", "00#", '#', Items.stick, 'I', Items.diamond }); GameRegistry.addRecipe(new ItemStack(stoneChisel, 1, 0), new Object[] { "I00", "0I0", "00#", '#', Items.stick, 'I', Blocks.cobblestone }); /* -=[ Recipes Pickaxes Heads ]=- *//*–------------------------------------*/ GameRegistry.addRecipe(new ItemStack(diamPickHead, 1, 0), new Object[] { "###", "HC0", "000", 'H', new ItemStack(diamHammer, 1, OreDictionary.WILDCARD_VALUE), '#', Items.diamond, 'C', new ItemStack(diamChisel, 1, OreDictionary.WILDCARD_VALUE) }); GameRegistry.addRecipe(new ItemStack(goldPickHead, 1, 0), new Object[] { "###", "HC0", "000", 'H', new ItemStack(ironHammer, 1, OreDictionary.WILDCARD_VALUE), '#', Items.gold_ingot, 'C', new ItemStack(ironChisel, 1, OreDictionary.WILDCARD_VALUE) }); GameRegistry.addRecipe(new ItemStack(ironPickHead, 1, 0), new Object[] { "###", "HC0", "000", 'H', new ItemStack(ironHammer, 1, OreDictionary.WILDCARD_VALUE), '#', Items.iron_ingot, 'C', new ItemStack(ironChisel, 1, OreDictionary.WILDCARD_VALUE) }); GameRegistry.addRecipe(new ItemStack(stonePickHead, 1, 0), new Object[] { "###", "HC0", "000", 'H', new ItemStack(stoneHammer, 1, OreDictionary.WILDCARD_VALUE), '#', Blocks.cobblestone, 'C', new ItemStack(stoneChisel, 1, OreDictionary.WILDCARD_VALUE) }); GameRegistry.addRecipe(new ItemStack(woodPickHead, 1, 0), new Object[] { "###", "S00", "000", 'S', new ItemStack(woodSaw, 1, OreDictionary.WILDCARD_VALUE), '#', new ItemStack(Blocks.planks, 1, OreDictionary.WILDCARD_VALUE) }); /* -=[ Recipes Axe Heads ]=- *//*–-----------------------------------------*/ GameRegistry.addRecipe(new ItemStack(diamAxeHead, 1, 0), new Object[] { "0##", "HC#", "000", 'H', new ItemStack(diamHammer, 1, OreDictionary.WILDCARD_VALUE), '#', Items.diamond, 'C', new ItemStack(diamChisel, 1, OreDictionary.WILDCARD_VALUE) }); GameRegistry.addRecipe(new ItemStack(goldAxeHead, 1, 0), new Object[] { "0##", "HC#", "000", 'H', new ItemStack(ironHammer, 1, OreDictionary.WILDCARD_VALUE), '#', Items.gold_ingot, 'C', new ItemStack(ironChisel, 1, OreDictionary.WILDCARD_VALUE) }); GameRegistry.addRecipe(new ItemStack(ironAxeHead, 1, 0), new Object[] { "0##", "HC#", "000", 'H', new ItemStack(ironHammer, 1, OreDictionary.WILDCARD_VALUE), '#', Items.iron_ingot, 'C', new ItemStack(ironChisel, 1, OreDictionary.WILDCARD_VALUE) }); GameRegistry.addRecipe(new ItemStack(stoneAxeHead, 1, 0), new Object[] { "0##", "HC#", "000", 'H', new ItemStack(stoneHammer, 1, OreDictionary.WILDCARD_VALUE), '#', Blocks.cobblestone, 'C', new ItemStack(stoneChisel, 1, OreDictionary.WILDCARD_VALUE) }); GameRegistry.addRecipe(new ItemStack(woodAxeHead, 1, 0), new Object[] { "0##", "S0#", "000", 'S', new ItemStack(woodSaw, 1, OreDictionary.WILDCARD_VALUE), '#', new ItemStack(Blocks.planks, 1, OreDictionary.WILDCARD_VALUE) }); /* -=[ Recipes Shovel Heads ]=- *//*–--------------------------------------*/ GameRegistry.addRecipe(new ItemStack(diamShovelHead, 1, 0), new Object[] { "0#0", "HC0", "000", 'H', new ItemStack(diamHammer, 1, OreDictionary.WILDCARD_VALUE), '#', Items.diamond, 'C', new ItemStack(diamChisel, 1, OreDictionary.WILDCARD_VALUE) }); GameRegistry.addRecipe(new ItemStack(goldShovelHead, 1, 0), new Object[] { "0#0", "HC0", "000", 'H', new ItemStack(ironHammer, 1, OreDictionary.WILDCARD_VALUE), '#', Items.gold_ingot, 'C', new ItemStack(ironChisel, 1, OreDictionary.WILDCARD_VALUE) }); GameRegistry.addRecipe(new ItemStack(ironShovelHead, 1, 0), new Object[] { "0#0", "HC0", "000", 'H', new ItemStack(ironHammer, 1, OreDictionary.WILDCARD_VALUE), '#', Items.iron_ingot, 'C', new ItemStack(ironChisel, 1, OreDictionary.WILDCARD_VALUE) }); GameRegistry.addRecipe(new ItemStack(stoneShovelHead, 1, 0), new Object[] { "0#0", "HC0", "000", 'H', new ItemStack(stoneHammer, 1, OreDictionary.WILDCARD_VALUE), '#', Blocks.cobblestone, 'C', new ItemStack(stoneChisel, 1, OreDictionary.WILDCARD_VALUE) }); GameRegistry.addRecipe(new ItemStack(woodShovelHead, 1, 0), new Object[] { "0#0", "S00", "000", 'S', new ItemStack(woodSaw, 1, OreDictionary.WILDCARD_VALUE), '#', new ItemStack(Blocks.planks, 1, OreDictionary.WILDCARD_VALUE) }); } public void init(FMLInitializationEvent event) { proxy.registerRender(); } public void postInit(FMLPostInitializationEvent event) { } }
TESR :
package com.SpyMan.TinkerCraft.Blocks.Lantern; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import com.SpyMan.TinkerCraft.*; public class TileEntityLanternSpecialRenderer extends TileEntitySpecialRenderer { @SideOnly(Side.CLIENT) public static ModelLantern modelLantern = new ModelLantern(); public static ResourceLocation lanternTexture = new ResourceLocation("TinkerCraft:textures/models/blocks/lantern_model.png"); public TileEntityLanternSpecialRenderer() { this.func_147497_a(TileEntityRendererDispatcher.instance); } private void renderTileEntityTileLanternAt(TileLantern tile, double x, double y, double z, float partialRenderTick) { GL11.glPushMatrix(); GL11.glTranslated(x + 0.5D, y + 1.5D, z + 0.5D); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); this.bindTexture(lanternTexture); modelLantern.renderAll(); GL11.glPopMatrix(); } public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialRenderTick) { this.renderTileEntityTileLanternAt((TileLantern) tile, x, y, z, partialRenderTick); } }
Bloc :
package com.SpyMan.TinkerCraft.Blocks.Lantern; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import org.lwjgl.opengl.GL11; import com.SpyMan.TinkerCraft.proxy.ClientProxy; import com.SpyMan.TinkerCraft.MainClass; public class Lantern extends Block { public Lantern() { super (Material.glass); setResistance(1.0F); setLightLevel(1.0F); setHardness(0.0F); } public boolean isOpaqueCube() { return false; } public boolean setTranslucent() { return true; } public boolean renderAsNormalBlock() { return false; } public int getRenderType() { return ClientProxy.tesrRenderId; } public TileEntity createTileEntity(World world, int metadata) { return new TileLantern(); } public boolean hasTileEntity(int metadata) { return true; } // public void renderInventoryBlock(Block block, int metadata, int modelId, // RenderBlocks renderer) { // if (block == MainClass.lantern && metadata == 0) { // GL11.glPushMatrix(); // GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); // GL11.glTranslatef(0.0F, -1.0F, 0.0F); // Minecraft.getMinecraft().getTextureManager() // .bindTexture(TileEntityLanternSpecialRenderer.texture); // TileEntityLanternSpecialRenderer.modelLantern.renderAll(); // GL11.glPopMatrix(); // } // } public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.625F, 0.75F); } }
Client Proxy :
package com.SpyMan.TinkerCraft.proxy; import com.SpyMan.TinkerCraft.Blocks.Lantern.TESRInventoryRenderer; import com.SpyMan.TinkerCraft.Blocks.Lantern.TileEntityLanternSpecialRenderer; import com.SpyMan.TinkerCraft.Blocks.Lantern.TileLantern; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; public class ClientProxy extends CommonProxy { public static int tesrRenderId; @Override public void registerRender() { ClientRegistry.bindTileEntitySpecialRenderer(TileLantern.class, new TileEntityLanternSpecialRenderer()); tesrRenderId = RenderingRegistry.getNextAvailableRenderId(); RenderingRegistry.registerBlockHandler(new TESRInventoryRenderer()); } }
TESR inventory :
package com.SpyMan.TinkerCraft.Blocks.Lantern; import org.lwjgl.opengl.GL11; import com.SpyMan.TinkerCraft.MainClass; import com.SpyMan.TinkerCraft.proxy.ClientProxy; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.world.IBlockAccess; public class TESRInventoryRenderer implements ISimpleBlockRenderingHandler { @Override public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { if(block == MainClass.lantern && metadata == 0) { GL11.glPushMatrix(); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(0.0F, -1.0F, 0.0F); Minecraft.getMinecraft().getTextureManager().bindTexture(TileEntityLanternSpecialRenderer.lanternTexture); TileEntityLanternSpecialRenderer.modelLantern.renderAll(); GL11.glPopMatrix(); } } @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { return false; } @Override public boolean shouldRender3DInInventory(int modelId) { return true; } @Override public int getRenderId() { return ClientProxy.tesrRenderId; } } ```</irecipe>
-
Ton modid doit être entièrement en minuscules, pense à faire comme dans le tutoriel : utiliser une variable statique et finale et y mettre le modid en minuscules. Ensuite utilise cette variable pour ta ResourceLocation
-
Ca ne fonctionne toujours pas
et dans les logs il n’y ya pas de “Missing Texture” -
Bon comme j’ai la flemme de copier toutes tes classes dans eclipse envoies-moi un zip de ton dossier src je vais regarder de mon côté.
-
en pièce jointe.
-
proxy.registerRender();
→ à mettre avant l’initialisation du bloc et non dans init.
D’ailleurs les recettes devrait être dans init.