Résolu Problème d'affichage de TileEntity
-
Bonjour, c’est encore moi, Eryah. J’ai suivi ce turotiel http://www.minecraftforgefrance.fr/showthread.php?tid=1509 pour avoir un rendu avancé d’un bloc avec un TESR. Or, quand je pose mon bloc, mon TileEntity n’est pas là
Classe du bloc
package eryah.usefulthings.blocks; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.entity.item.EntityItem; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.GameRegistry; import eryah.usefulthings.Reference; import eryah.usefulthings.UsefulthingsMod; import eryah.usefulthings.tileentity.TileEntityPlateCrafter; public class PlateCrafter extends BlockContainer { public static Block platecrafter; public PlateCrafter(Material material) { super(material); } @Override public TileEntity createNewTileEntity(World world, int metadata) //Instancie le TileEntity { return new TileEntityPlateCrafter(); } public boolean hasTileEntity(int metadata) //Permet de savoir si le bloc a un TileEntity { return true; } public static void init() { platecrafter = new PlateCrafter(Material.rock).setUnlocalizedName("platecrafter").setCreativeTab(UsefulthingsMod.UTTab); } public static void register() { GameRegistry.registerBlock(platecrafter, platecrafter.getUnlocalizedName().substring(5)); } public static void registerRenders() { registerRender(platecrafter); } public static void registerRender(Block block) { Item item = Item.getItemFromBlock(block); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory")); } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } public int getRenderType() { return -1; } }
Classe du TileEntity
package eryah.usefulthings.tileentity; import eryah.usefulthings.recipes.PlateCrafterRecipes; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; public class TileEntityPlateCrafter extends TileEntity { private ItemStack[] contents = new ItemStack[4]; //0, 1 et 2 sont les inputs et 3 est l'output private int workingTime = 0; //Temps de cuisson actuel private int workingTimeNeeded = 10; //Temps de cuisson nécessaire @Override public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < this.contents.length; ++i) //pour les slots { if (this.contents* != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("Slot", (byte)i); this.contents*.writeToNBT(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1); } } compound.setTag("Items", nbttaglist); compound.setShort("workingTime",(short)this.workingTime); //On les enregistrent en short compound.setShort("workingTimeNeeded", (short)this.workingTimeNeeded); } @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); NBTTagList nbttaglist = compound.getTagList("Items", 10); this.contents = new ItemStack[this.getSizeInventory()]; for (int i = 0; i < nbttaglist.tagCount(); ++i) //Encore une fois pour les slots { NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); int j = nbttagcompound1.getByte("Slot") & 255; if (j >= 0 && j < this.contents.length) { this.contents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); } } this.workingTime = compound.getShort("workingTime"); //On lit nos valeurs this.workingTimeNeeded = compound.getShort("workingTimeNeeded"); } public int getSizeInventory() { //Tout est dans le nom, retourne la taille de l'inventaire, pour notre bloc c'est quatre return this.contents.length; } public ItemStack getStackInSlot(int slotIndex) { //Renvoie L'itemStack se trouvant dans le slot passé en argument return this.contents[slotIndex]; } public ItemStack decrStackSize(int slotIndex, int amount) { if (this.contents[slotIndex] != null) { ItemStack itemstack; if (this.contents[slotIndex].stackSize <= amount) { itemstack = this.contents[slotIndex]; this.contents[slotIndex] = null; this.markDirty(); return itemstack; } else { itemstack = this.contents[slotIndex].splitStack(amount); if (this.contents[slotIndex].stackSize == 0) { this.contents[slotIndex] = null; } this.markDirty(); return itemstack; } } else { return null; } } public ItemStack getStackInSlotOnClosing(int slotIndex) { if (this.contents[slotIndex] != null) { ItemStack itemstack = this.contents[slotIndex]; this.contents[slotIndex] = null; return itemstack; } else { return null; } } public void setInventorySlotContents(int slotIndex, ItemStack stack) { this.contents[slotIndex] = stack; if (stack != null && stack.stackSize > this.getInventoryStackLimit()) { stack.stackSize = this.getInventoryStackLimit(); } this.markDirty(); } public String getInventoryName() { //J'ai décider qu'on ne pouvait pas mettre de nom custom return "tile.PlateCrafter"; } public boolean hasCustomInventoryName() { return false; } public int getInventoryStackLimit() { return 64; } public void openInventory() { } public void closeInventory() { } public boolean isItemValidForSlot(int slot, ItemStack stack) { return slot == 3 ? false : true; } public boolean isBurning() { return this.workingTime > 0; } private boolean canSmelt() { if (this.contents[0] == null ) //Si les trois premiers slots sont vides { return false; //On ne peut pas lancer le processus } else { ItemStack itemstack = PlateCrafterRecipes.smelting().getSmeltingResult(new ItemStack[]{this.contents[0]}); //Il y a une erreur ici, c'est normal, on y vient après (c'est pour les recettes) if (itemstack == null) return false; //rapport avec les recettes if (this.contents[3] == null) return true; //vérifications du slot d'output if (!this.contents[3].isItemEqual(itemstack)) return false; //ici aussi int result = contents[3].stackSize + itemstack.stackSize; return result <= getInventoryStackLimit() && result <= this.contents[3].getMaxStackSize(); //Et là aussi décidément } } public void updateEntity() //Méthode exécutée à chaque tick { if(this.isBurning() && this.canSmelt()) //Si on "cuit" et que notre recette et toujours bonne, on continue { ++this.workingTime; //incrémentation } if(this.canSmelt() && !this.isBurning()) //Si la recette est bonne mais qu'elle n'est toujours pas lancée, on la lance { this.workingTime = 1; //La méthode isBurning() renverra true maintenant (1>0) } if(this.canSmelt() && this.workingTime == this.workingTimeNeeded) //Si on est arrivé au bout du temps de cuisson et que la recette est toujours bonne { this.smeltItem(); //on "cuit" les items this.workingTime = 0; //et on réinitialise le temps de cuisson } if(!this.canSmelt()) //Si la recette la recette n'est plus bonne { this.workingTime= 0; //le temps de cuisson est de 0 } } public void smeltItem() { if (this.canSmelt()) { ItemStack itemstack = PlateCrafterRecipes.smelting().getSmeltingResult(new ItemStack[]{this.contents[0]}); //On récupère l'output de la recette if (this.contents[1] == null) //Si il y a rien dans le slot d'output { this.contents[1] = itemstack.copy(); //On met directement l'ItemStack } else if (this.contents[1].getItem() == itemstack.getItem()) //Et si l'item que l'on veut est le même que celui qu'il y a déjà { this.contents[1].stackSize += itemstack.stackSize; // Alors ont incrémente l'ItemStack } –this.contents[0].stackSize; //On décrémente les slots d'input if (this.contents[0].stackSize <= 0) //Si les slots sont vides, on remet à null le slot { this.contents[0] = null; } } } }
Classe du TileEntitySpecialRenderer
package eryah.usefulthings.client; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import eryah.usefulthings.Reference; import eryah.usefulthings.tileentity.TileEntityPlateCrafter; public class TileEntityPlateCrafterSpecialRenderer extends TileEntitySpecialRenderer { public static Modelplatecrafter model = new Modelplatecrafter(); public static ResourceLocation texture = new ResourceLocation(Reference.MOD_ID, "textures/models/blocks/platecrafter.png"); public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialRenderTick) { double posZ; double p_180535_6_; float p_180535_8_; int p_180535_9_; { } } public void renderTileEntityPlateCrafterAt(TileEntity tile, double x, double y, double z, float partialRenderTick) // la fonction qui était la de base { this.renderTileEntityPlateCrafterAt((TileEntityPlateCrafter)tile, x, y, z, partialRenderTick); // j'appelle ma fonction renderTileEntityTutorielAt en castant TileEntityTutoriel à l'argument tile } private void renderTileEntityTutorielAt(TileEntityPlateCrafter tile, double x, double y, double z, float partialRenderTick) // ma propre fonction { GL11.glPushMatrix(); // ouvre une matrix GL11.glTranslated(x + 0.5D, y + 1.5D, z + 0.5D); // déplace le bloc sur les coordonnés et le centre GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); // met droit le bloc (par défaut il est à l'envers) this.bindTexture(texture); // affiche la texture model.renderAll(); // rend le modèle GL11.glPopMatrix(); // ferme la matrix } @Override public void renderTileEntityAt(TileEntity p_180535_1_, double posX, double posZ, double p_180535_6_, float p_180535_8_, int p_180535_9_) { // TODO Auto-generated method stub }}
-
Salut,
Visiblement en 1.8 la fonctionpublic void renderTileEntityPlateCrafterAt(TileEntity tile, double x, double y, double z, float partialRenderTick)
n’existe plus dans la classe TileEntity, elle a été remplacée par :
public void renderTileEntityAt(TileEntity p_180535_1_, double posX, double posZ, double p_180535_6_, float p_180535_8_, int p_180535_9_)
-
Le bloc ne s’affiche toujours pas
-
Client proxy ? Classe principale ?
-
Deso, mob PC est éteint, impossible. De. Te. Donner. La classr
Envoyé de mon SM-G357FZ en utilisant Tapatalk
-
MainClass
package eryah.usefulthings; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import eryah.usefulthings.blocks.MarkedRoadBlock; import eryah.usefulthings.blocks.PlateCrafter; import eryah.usefulthings.blocks.ResinLeaves; import eryah.usefulthings.blocks.RoadBlock; import eryah.usefulthings.blocks.Scaffolding; import eryah.usefulthings.init.BottleHerm; import eryah.usefulthings.init.BucketHerm; import eryah.usefulthings.init.Chainsaw; import eryah.usefulthings.init.CoalPowder; import eryah.usefulthings.init.Engine; import eryah.usefulthings.init.GoldenEgg; import eryah.usefulthings.init.LapisAxe; import eryah.usefulthings.init.LapisPickaxe; import eryah.usefulthings.init.LapisShovel; import eryah.usefulthings.init.LapisSword; import eryah.usefulthings.init.PolishedLapis; import eryah.usefulthings.init.ResinTree; import eryah.usefulthings.init.SteelAxe; import eryah.usefulthings.init.SteelIngot; import eryah.usefulthings.init.SteelPickaxe; import eryah.usefulthings.init.SteelShovel; import eryah.usefulthings.init.SteelSword; import eryah.usefulthings.init.UTResin; import eryah.usefulthings.init.VegeStick; import eryah.usefulthings.proxy.CommonProxy; import eryah.usefulthings.tileentity.TileEntityPlateCrafter; @Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION) public class UsefulthingsMod { @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS) public static CommonProxy proxy; public static final CreativeTab UTTab = new CreativeTab("UTTab"); public static ToolMaterial chainsawMat = EnumHelper.addToolMaterial("chainsawMat", 1, 1000, 15.0F, 3.0F, 14); public static ToolMaterial steelMat = EnumHelper.addToolMaterial("steelMat", 2, 1200, 7.0F, 3.0F, 16); public static ToolMaterial lapisMat = EnumHelper.addToolMaterial("lapisMat", 2, 600, 7.0F, 3.0F, 20); @EventHandler public void preInit(FMLPreInitializationEvent event) { ResinTree.init(); ResinTree.register(); UTResin.init(); UTResin.register(); Engine.init(); Engine.register(); ResinLeaves.init(); ResinLeaves.register(); Chainsaw.init(); Chainsaw.register(); BucketHerm.init(); BucketHerm.register(); CoalPowder.init(); CoalPowder.register(); SteelIngot.init(); SteelIngot.register(); SteelSword.init(); SteelSword.register(); SteelAxe.init(); SteelAxe.register(); SteelPickaxe.init(); SteelPickaxe.register(); SteelShovel.init(); SteelShovel.register(); PlateCrafter.init(); PlateCrafter.register(); VegeStick.init(); VegeStick.register(); Scaffolding.init(); Scaffolding.register(); BottleHerm.init(); BottleHerm.register(); RoadBlock.init(); RoadBlock.register(); MarkedRoadBlock.init(); MarkedRoadBlock.register(); GoldenEgg.init(); GoldenEgg.register(); PolishedLapis.init(); PolishedLapis.register(); LapisSword.init(); LapisSword.register(); LapisAxe.init(); LapisAxe.register(); LapisPickaxe.init(); LapisPickaxe.register(); LapisShovel.init(); LapisShovel.register(); GameRegistry.registerTileEntity(TileEntityPlateCrafter.class, "TileEntityPlateCrafter"); } @EventHandler public void init(FMLInitializationEvent event) { proxy.registerRenders(); GameRegistry.addRecipe(new ItemStack(Engine.engine), new Object[]{" R ", "PRP","RRR", 'R',Items.redstone, 'P',Blocks.piston}); GameRegistry.addShapelessRecipe(new ItemStack(BucketHerm.bucketherm), UTResin.resin, Items.bucket, Blocks.sand); GameRegistry.addRecipe(new ItemStack(Chainsaw.chainsaw), new Object[]{"I ", " IC"," CM", 'I',Items.iron_ingot, 'M',Engine.engine, 'C', new ItemStack(Items.dye, 1, 14)}); GameRegistry.addShapelessRecipe(new ItemStack(CoalPowder.coalpowder), Items.coal); GameRegistry.addShapelessRecipe(new ItemStack(CoalPowder.coalpowder), new ItemStack(Items.coal, 1, 1)); GameRegistry.addShapelessRecipe(new ItemStack(SteelIngot.steelingot), CoalPowder.coalpowder ,Items.iron_ingot); GameRegistry.addRecipe(new ItemStack(SteelSword.SteelSword), new Object[]{" A ", " A ", " S ", 'A',SteelIngot.steelingot, 'S',Items.stick}); GameRegistry.addRecipe(new ItemStack(SteelAxe.SteelAxe), new Object[]{"AA ", "AS ", " S ", 'A',SteelIngot.steelingot, 'S',Items.stick}); GameRegistry.addRecipe(new ItemStack(SteelPickaxe.SteelPickaxe), new Object[]{"AAA", " S ", " S ", 'A',SteelIngot.steelingot, 'S',Items.stick}); GameRegistry.addRecipe(new ItemStack(SteelShovel.SteelShovel), new Object[]{" A ", " S ", " S ", 'A',SteelIngot.steelingot, 'S',Items.stick}); GameRegistry.addRecipe(new ItemStack(PlateCrafter.platecrafter), new Object[]{" I ", "CSC", "CTC", 'I',Blocks.iron_block, 'S',Items.stick, 'C',Blocks.cobblestone, 'T',Blocks.crafting_table}); GameRegistry.addShapelessRecipe(new ItemStack(VegeStick.vegetal_stick), Items.stick , Blocks.vine); GameRegistry.addShapelessRecipe(new ItemStack(VegeStick.vegetal_stick), Items.stick , new ItemStack(Blocks.tallgrass, 3, 0)); GameRegistry.addRecipe(new ItemStack(Scaffolding.scaffolding, 8), new Object[]{" S ", "SPS"," S ", 'S',Items.stick, 'P',Blocks.planks}); GameRegistry.addShapelessRecipe(new ItemStack(BottleHerm.bottleherm), Items.glass_bottle, BucketHerm.bucketherm); GameRegistry.addShapelessRecipe(new ItemStack(Items.gold_nugget, 4), GoldenEgg.golden_egg); GameRegistry.addRecipe(new ItemStack(PolishedLapis.polished_lapislazuli), new Object[]{"LL", "LL", 'L', new ItemStack(Items.dye, 1, 4)}); GameRegistry.addRecipe(new ItemStack(LapisSword.LapisSword), new Object[]{" L ", " L ", " S ", 'L',PolishedLapis.polished_lapislazuli, 'S',Items.stick}); GameRegistry.addRecipe(new ItemStack(LapisAxe.LapisAxe), new Object[]{"LL ", "LS ", " S ", 'L',PolishedLapis.polished_lapislazuli, 'S',Items.stick}); GameRegistry.addRecipe(new ItemStack(LapisPickaxe.LapisPickaxe), new Object[]{"LLL", " S ", " S ", 'L',PolishedLapis.polished_lapislazuli, 'S',Items.stick}); GameRegistry.addRecipe(new ItemStack(LapisShovel.LapisShovel), new Object[]{" L ", " S ", " S ", 'L',PolishedLapis.polished_lapislazuli, 'S',Items.stick}); } @EventHandler public void PostInit(FMLPostInitializationEvent event) { } }
ClientProxy
package eryah.usefulthings.proxy; import net.minecraftforge.fml.client.registry.ClientRegistry; import eryah.usefulthings.blocks.MarkedRoadBlock; import eryah.usefulthings.blocks.PlateCrafter; import eryah.usefulthings.blocks.ResinLeaves; import eryah.usefulthings.blocks.RoadBlock; import eryah.usefulthings.blocks.Scaffolding; import eryah.usefulthings.client.TileEntityPlateCrafterSpecialRenderer; import eryah.usefulthings.init.BottleHerm; import eryah.usefulthings.init.BucketHerm; import eryah.usefulthings.init.Chainsaw; import eryah.usefulthings.init.CoalPowder; import eryah.usefulthings.init.Engine; import eryah.usefulthings.init.GoldenEgg; import eryah.usefulthings.init.LapisAxe; import eryah.usefulthings.init.LapisPickaxe; import eryah.usefulthings.init.LapisShovel; import eryah.usefulthings.init.LapisSword; import eryah.usefulthings.init.PolishedLapis; import eryah.usefulthings.init.ResinTree; import eryah.usefulthings.init.SteelAxe; import eryah.usefulthings.init.SteelIngot; import eryah.usefulthings.init.SteelPickaxe; import eryah.usefulthings.init.SteelShovel; import eryah.usefulthings.init.SteelSword; import eryah.usefulthings.init.UTResin; import eryah.usefulthings.init.VegeStick; import eryah.usefulthings.tileentity.TileEntityPlateCrafter; public class ClientProxy extends CommonProxy { @Override public void registerRenders() { ResinTree.registerRenders(); UTResin.registerRenders(); Engine.registerRenders(); ResinLeaves.registerRenders(); Chainsaw.registerRenders(); BucketHerm.registerRenders(); CoalPowder.registerRenders(); SteelIngot.registerRenders(); SteelAxe.registerRenders(); SteelSword.registerRenders(); SteelPickaxe.registerRenders(); SteelShovel.registerRenders(); PlateCrafter.registerRenders(); VegeStick.registerRenders(); Scaffolding.registerRenders(); BottleHerm.registerRenders(); RoadBlock.registerRenders(); MarkedRoadBlock.registerRenders(); GoldenEgg.registerRenders(); PolishedLapis.registerRenders(); LapisAxe.registerRenders(); LapisSword.registerRenders(); LapisPickaxe.registerRenders(); LapisShovel.registerRenders(); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPlateCrafter.class, new TileEntityPlateCrafterSpecialRenderer()); } }
-
Je ne vois aucun problème dans ces deux classes. TileEntityPlateCrafterSpecialRenderer ressemble à quoi actuellement ?
-
package eryah.usefulthings.client; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import eryah.usefulthings.Reference; import eryah.usefulthings.tileentity.TileEntityPlateCrafter; public class TileEntityPlateCrafterSpecialRenderer extends TileEntitySpecialRenderer { public static Modelplatecrafter model = new Modelplatecrafter(); public static ResourceLocation texture = new ResourceLocation(Reference.MOD_ID, "textures/models/blocks/platecrafter.png"); public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialRenderTick) { double posZ; double p_180535_6_; float p_180535_8_; int p_180535_9_; { } } public void renderTileEntityPlateCrafterAt(TileEntity tile, double x, double y, double z, float partialRenderTick) // la fonction qui était la de base { this.renderTileEntityPlateCrafterAt((TileEntityPlateCrafter)tile, x, y, z, partialRenderTick); // j'appelle ma fonction renderTileEntityTutorielAt en castant TileEntityTutoriel à l'argument tile } private void renderTileEntityTutorielAt(TileEntityPlateCrafter tile, double x, double y, double z, float partialRenderTick) // ma propre fonction { GL11.glPushMatrix(); // ouvre une matrix GL11.glTranslated(x + 0.5D, y + 1.5D, z + 0.5D); // déplace le bloc sur les coordonnés et le centre GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); // met droit le bloc (par défaut il est à l'envers) this.bindTexture(texture); // affiche la texture model.renderAll(); // rend le modèle GL11.glPopMatrix(); // ferme la matrix } @Override public void renderTileEntityAt(TileEntity p_180535_1_, double posX, double posZ, double p_180535_6_, float p_180535_8_, int p_180535_9_) { // TODO Auto-generated method stub } }
-
package eryah.usefulthings.client; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import eryah.usefulthings.Reference; import eryah.usefulthings.tileentity.TileEntityPlateCrafter; public class TileEntityPlateCrafterSpecialRenderer extends TileEntitySpecialRenderer { public static Modelplatecrafter model = new Modelplatecrafter(); public static ResourceLocation texture = new ResourceLocation(Reference.MOD_ID, "textures/models/blocks/platecrafter.png"); public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialRenderTick) { double posZ; double p_180535_6_; float p_180535_8_; int p_180535_9_; { } } public void renderTileEntityPlateCrafterAt(TileEntity tile, double x, double y, double z, float partialRenderTick) // la fonction qui était la de base { this.renderTileEntityPlateCrafterAt((TileEntityPlateCrafter)tile, x, y, z, partialRenderTick); // j'appelle ma fonction renderTileEntityTutorielAt en castant TileEntityTutoriel à l'argument tile } private void renderTileEntityTutorielAt(TileEntityPlateCrafter tile, double x, double y, double z, float partialRenderTick) // ma propre fonction { GL11.glPushMatrix(); // ouvre une matrix GL11.glTranslated(x + 0.5D, y + 1.5D, z + 0.5D); // déplace le bloc sur les coordonnés et le centre GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); // met droit le bloc (par défaut il est à l'envers) this.bindTexture(texture); // affiche la texture model.renderAll(); // rend le modèle GL11.glPopMatrix(); // ferme la matrix } @Override public void renderTileEntityAt(TileEntity p_180535_1_, double posX, double posZ, double p_180535_6_, float p_180535_8_, int p_180535_9_) { // TODO Auto-generated method stub } }
-
….
Tu n’as pas du tout fait ce que j’ai t’es dit de faire. Pas étonnant que ça ne fonctionne pas.package eryah.usefulthings.client; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import eryah.usefulthings.Reference; import eryah.usefulthings.tileentity.TileEntityPlateCrafter; public class TileEntityPlateCrafterSpecialRenderer extends TileEntitySpecialRenderer { public static Modelplatecrafter model = new Modelplatecrafter(); public static ResourceLocation texture = new ResourceLocation(Reference.MOD_ID, "textures/models/blocks/platecrafter.png"); private void renderTileEntityTutorielAt(TileEntityPlateCrafter tile, double x, double y, double z, float partialRenderTick) // ma propre fonction { GL11.glPushMatrix(); // ouvre une matrix GL11.glTranslated(x + 0.5D, y + 1.5D, z + 0.5D); // déplace le bloc sur les coordonnés et le centre GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); // met droit le bloc (par défaut il est à l'envers) this.bindTexture(texture); // affiche la texture model.renderAll(); // rend le modèle GL11.glPopMatrix(); // ferme la matrix } @Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialRenderTick, int i) { this.renderTileEntityPlateCrafterAt((TileEntityPlateCrafter)tile, x, y, z, partialRenderTick); // j'appelle ma fonction renderTileEntityTutorielAt en castant TileEntityTutoriel à l'argument tile } }
-
Effectivement, ça marche beaucoup mieux maintenant
Merci beaucoup robin