Rendu de bloc TESR
-
metadata, car il faut passer par le tile entity
-
D’accord comme je suis loin d’être un pro j’ai essayé et j’ai quelques problème

BlockBarriere
package mod.common; import javax.swing.Icon; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import mod.proxy.ClientProxy; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockBarriere extends Block { public BlockBarriere(int id) { super(Material.rock); } public boolean hasTileEntity(int metadata) { return true; } public boolean renderAsNormalBlock() { return false; } public boolean isOpaqueCube() { return false; } @SideOnly(Side.CLIENT) public int getRenderType() { return ClientProxy.renderInventoryBarriere; } protected BlockBarriere(Material material) { super(material); } public IIcon getIcon(int side, int metadata) { return ((Blocks.iron_block).getIcon(0, 0)); } @Override public TileEntity createTileEntity(World world, int metadata) { if(metadata == 0) return new TileEntityBarriere(); else if(metadata == 2) return new TileEntityBarriere2(); else return null; } public boolean hasTileEntity1(int metadata) { if(metadata == 0 || metadata == 2) return true; else return false; } public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack) { int direction = MathHelper.floor_double((double)(living.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3; TileEntity te = world.getTileEntity(x, y, z); if(te != null && stack.getItemDamage() == 2 && te instanceof TileEntityBarriere2) { ((TileEntityBarriere2)te).setDirection((byte)direction); world.markBlockForUpdate(x, y, z); } } @SideOnly(Side.CLIENT) public IIcon getBlockTexture(IBlockAccess blockaccess, int x, int y, int z, int side) { if(blockaccess.getBlockMetadata(x, y, z) == 2) { TileEntity te = blockaccess.getTileEntity(x, y, z); byte direction = ((TileEntityBarriere2)te).getDirection(); return side == 1 ? Icon3[0] : (side == 0 ? Icon3[1] : (direction == 2 && side == 2 ? Icon3[2] : (direction == 3 && side == 5 ? Icon3[2] : (direction == 0 && side == 3 ? Icon3[2] : (direction == 1 && side == 4 ? Icon3[2] : Icon3[3]))))); } else { return this.getIcon(side, blockaccess.getBlockMetadata(x, y, z)); } } }TileEntityBarriere2
package mod.common; import net.minecraft.tileentity.TileEntity; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.Packet; import net.minecraft.tileentity.TileEntity; public class TileEntityBarriere2 extends TileEntity { public byte direction; public void readFromNBT(NBTTagCompound nbtTag) { super.readFromNBT(nbtTag); direction = nbtTag.getByte("direction"); } public void writeToNBT(NBTTagCompound nbtTag) { super.writeToNBT(nbtTag); nbtTag.setByte("direction", direction); } public void setDirection(byte direct) { direction = direct; } public byte getDirection() { return direction; } public Packet getDescriptionPacket() { NBTTagCompound nbttagcompound = new NBTTagCompound(); this.writeToNBT(nbttagcompound); return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 4, nbttagcompound); } public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt) { this.readFromNBT(pkt.data); } }le Packet132TileEntityData est souligné en rouge

mais j’ai plein d’erreur
-
En effet les fonctions ne sont pas les mêmes en 1.7.
public Packet getDescriptionPacket() { NBTTagCompound nbttagcompound = new NBTTagCompound(); this.writeToNBT(nbttagcompound); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbttagcompound); } public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { this.readFromNBT(pkt.func_148857_g()); this.worldObj.markBlockRangeForRenderUpdate(this.xCoord, this.yCoord, this.zCoord, this.xCoord, this.yCoord, this.zCoord); } -
Oké maintenant ce code :
@SideOnly(Side.CLIENT) public Icon getBlockTexture(IBlockAccess blockaccess, int x, int y, int z, int side) { if(blockaccess.getBlockMetadata(x, y, z) == 2) { TileEntity te = blockaccess.getBlockTileEntity(x, y, z); byte direction = ((TileEntityBarriere2)te).getDirection(); return side == 1 ? Icon3[0] : (side == 0 ? Icon3[1] : (direction == 2 && side == 2 ? Icon3[2] : (direction == 3 && side == 5 ? Icon3[2] : (direction == 0 && side == 3 ? Icon3[2] : (direction == 1 && side == 4 ? Icon3[2] : Icon3[3]))))); } else { return this.getIcon(side, blockaccess.getBlockMetadata(x, y, z)); } } ``` je dois bien le placer dans la classe du block ? Car sinon j'ai plein d'erreur comme getBlockTileEntity également Icon3 et getIcon :/ -
Inutile dans le cas du TESR, retire-le
-
Voila tout mes codes mais sa ne marche pas
Aucune erreur.TileEntityBarriere2
package mod.common; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.tileentity.TileEntity; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; public class TileEntityBarriere2 extends TileEntity { public byte direction; public void readFromNBT(NBTTagCompound nbtTag) { super.readFromNBT(nbtTag); direction = nbtTag.getByte("direction"); } public void writeToNBT(NBTTagCompound nbtTag) { super.writeToNBT(nbtTag); nbtTag.setByte("direction", direction); } public void setDirection(byte direct) { direction = direct; } public byte getDirection() { return direction; } public Packet getDescriptionPacket() { NBTTagCompound nbttagcompound = new NBTTagCompound(); this.writeToNBT(nbttagcompound); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbttagcompound); } public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { this.readFromNBT(pkt.func_148857_g()); this.worldObj.markBlockRangeForRenderUpdate(this.xCoord, this.yCoord, this.zCoord, this.xCoord, this.yCoord, this.zCoord); } }BlockBarriere
package mod.common; import javax.swing.Icon; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import mod.proxy.ClientProxy; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockBarriere extends Block { public BlockBarriere(int id) { super(Material.rock); } public boolean hasTileEntity(int metadata) { return true; } public boolean renderAsNormalBlock() { return false; } public boolean isOpaqueCube() { return false; } @SideOnly(Side.CLIENT) public int getRenderType() { return ClientProxy.renderInventoryBarriere; } protected BlockBarriere(Material material) { super(material); } public IIcon getIcon(int side, int metadata) { return ((Blocks.iron_block).getIcon(0, 0)); } @Override public TileEntity createTileEntity(World world, int metadata) { if(metadata == 0) return new TileEntityBarriere(); else if(metadata == 2) return new TileEntityBarriere2(); else return null; } public boolean hasTileEntity1(int metadata) { if(metadata == 0 || metadata == 2) return true; else return false; } public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack) { int direction = MathHelper.floor_double((double)(living.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3; TileEntity te = world.getTileEntity(x, y, z); if(te != null && stack.getItemDamage() == 2 && te instanceof TileEntityBarriere2) { ((TileEntityBarriere2)te).setDirection((byte)direction); world.markBlockForUpdate(x, y, z); } } } -
public boolean hasTileEntity1(int metadata)
ça c’est faux. C’est :
public boolean hasTileEntity(int metadata)
Je vois pas d’autre problème. -
Voici le crash report
Dé que j’ouvre le monde ca crash.
–-- Minecraft Crash Report ---- // Everything's going to plan. No, really, that was supposed to happen. Time: 25/07/14 0:19 Description: Rendering Block Entity java.lang.ClassCastException: mod.common.TileEntityBarriere cannot be cast to mod.common.TileEntityBarriere2 at mod.common.TileEntityBarriereSpecialRender.renderTileEntityAt(TileEntityBarriereSpecialRender.java:36) at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:141) at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntity(TileEntityRendererDispatcher.java:126) at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:544) at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1298) at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1095) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1024) at net.minecraft.client.Minecraft.run(Minecraft.java:912) at net.minecraft.client.main.Main.main(Main.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at mod.common.TileEntityBarriereSpecialRender.renderTileEntityAt(TileEntityBarriereSpecialRender.java:36) -- Block Entity Details -- Details: Name: Barriere // mod.common.TileEntityBarriere Block type: ID #166 (tile.blockBarriere // mod.common.BlockBarriere) Block data value: 0 / 0x0 / 0b0000 Block location: World: (-1113,4,-1261), Chunk: (at 7,0,3 in -70,-79; contains blocks -1120,0,-1264 to -1105,255,-1249), Region: (-3,-3; contains chunks -96,-96 to -65,-65, blocks -1536,0,-1536 to -1025,255,-1025) Actual block type: ID #166 (tile.blockBarriere // mod.common.BlockBarriere) Actual block data value: 0 / 0x0 / 0b0000 Stacktrace: at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:141) at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntity(TileEntityRendererDispatcher.java:126) at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:544) at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1298) -- Affected level -- Details: Level name: MpServer All players: 1 total; [EntityClientPlayerMP['Player484'/168, l='MpServer', x=-1112,35, y=5,62, z=-1261,52]] Chunk stats: MultiplayerChunkCache: 50, 50 Level seed: 0 Level generator: ID 01 - flat, ver 0\. Features enabled: false Level generator options: Level spawn location: World: (-1122,4,-1265), Chunk: (at 14,0,15 in -71,-80; contains blocks -1136,0,-1280 to -1121,255,-1265), Region: (-3,-3; contains chunks -96,-96 to -65,-65, blocks -1536,0,-1536 to -1025,255,-1025) Level time: 100988 game time, 6000 day time Level dimension: 0 Level storage version: 0x00000 - Unknown? Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false Forced entities: 74 total; [EntityPig['Pig'/128, l='MpServer', x=-1092,07, y=4,00, z=-1299,93], EntitySheep['Sheep'/129, l='MpServer', x=-1101,84, y=4,00, z=-1309,88], EntitySheep['Sheep'/130, l='MpServer', x=-1101,81, y=4,00, z=-1302,88], EntityPig['Pig'/135, l='MpServer', x=-1074,78, y=4,00, z=-1307,97], EntityChicken['Chicken'/136, l='MpServer', x=-1074,47, y=4,00, z=-1305,47], EntitySheep['Sheep'/137, l='MpServer', x=-1079,94, y=4,00, z=-1306,97], EntitySheep['Sheep'/138, l='MpServer', x=-1078,91, y=4,00, z=-1215,09], EntitySheep['Sheep'/145, l='MpServer', x=-1061,91, y=4,00, z=-1286,04], EntityHorse['Horse'/146, l='MpServer', x=-1056,81, y=4,00, z=-1283,50], EntityPig['Pig'/147, l='MpServer', x=-1060,81, y=4,00, z=-1283,91], EntityPig['Pig'/148, l='MpServer', x=-1067,09, y=4,00, z=-1260,84], EntitySheep['Sheep'/149, l='MpServer', x=-1063,88, y=4,00, z=-1234,03], EntityClientPlayerMP['Player484'/168, l='MpServer', x=-1112,35, y=5,62, z=-1261,52], EntitySheep['Sheep'/150, l='MpServer', x=-1060,06, y=4,00, z=-1246,09], EntityChicken['Chicken'/151, l='MpServer', x=-1066,69, y=4,00, z=-1209,19], EntityHorse['Donkey'/47, l='MpServer', x=-1167,28, y=4,00, z=-1218,84], EntityHorse['Horse'/54, l='MpServer', x=-1142,28, y=4,00, z=-1283,66], EntityItemFrame['entity.ItemFrame.name'/55, l='MpServer', x=-1136,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/56, l='MpServer', x=-1140,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/57, l='MpServer', x=-1144,50, y=5,50, z=-1264,06], EntityFlechette['entity.RenderFlechetteun.name'/58, l='MpServer', x=-1144,97, y=3,05, z=-1253,78], EntityFlechette['entity.RenderFlechetteun.name'/59, l='MpServer', x=-1139,06, y=3,05, z=-1260,81], EntityItemFrame['entity.ItemFrame.name'/67, l='MpServer', x=-1120,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/68, l='MpServer', x=-1121,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/69, l='MpServer', x=-1121,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/70, l='MpServer', x=-1120,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/71, l='MpServer', x=-1120,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/72, l='MpServer', x=-1121,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/73, l='MpServer', x=-1123,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/74, l='MpServer', x=-1124,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/75, l='MpServer', x=-1125,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/76, l='MpServer', x=-1125,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/77, l='MpServer', x=-1124,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/78, l='MpServer', x=-1123,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/79, l='MpServer', x=-1123,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/80, l='MpServer', x=-1124,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/81, l='MpServer', x=-1125,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/82, l='MpServer', x=-1129,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/83, l='MpServer', x=-1128,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/84, l='MpServer', x=-1127,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/85, l='MpServer', x=-1127,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/86, l='MpServer', x=-1128,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/87, l='MpServer', x=-1129,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/88, l='MpServer', x=-1128,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/89, l='MpServer', x=-1127,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/90, l='MpServer', x=-1129,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/91, l='MpServer', x=-1132,50, y=5,50, z=-1264,06], EntityHorse['Horse'/92, l='MpServer', x=-1121,19, y=4,88, z=-1265,00], EntityHorse['Donkey'/93, l='MpServer', x=-1133,91, y=4,00, z=-1216,09], EntityPig['Pig'/94, l='MpServer', x=-1121,84, y=4,00, z=-1207,84], EntitySheep['Sheep'/99, l='MpServer', x=-1108,50, y=4,00, z=-1306,16], EntityItemFrame['entity.ItemFrame.name'/100, l='MpServer', x=-1115,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/101, l='MpServer', x=-1116,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/102, l='MpServer', x=-1117,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/103, l='MpServer', x=-1117,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/104, l='MpServer', x=-1116,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/105, l='MpServer', x=-1115,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/106, l='MpServer', x=-1116,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/107, l='MpServer', x=-1117,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/108, l='MpServer', x=-1115,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/109, l='MpServer', x=-1119,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/110, l='MpServer', x=-1119,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/111, l='MpServer', x=-1119,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/112, l='MpServer', x=-1113,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/113, l='MpServer', x=-1112,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/114, l='MpServer', x=-1111,50, y=5,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/115, l='MpServer', x=-1112,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/116, l='MpServer', x=-1113,50, y=6,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/117, l='MpServer', x=-1113,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/118, l='MpServer', x=-1112,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/119, l='MpServer', x=-1111,50, y=7,50, z=-1264,06], EntityItemFrame['entity.ItemFrame.name'/120, l='MpServer', x=-1111,50, y=6,50, z=-1264,06], EntitySheep['Sheep'/121, l='MpServer', x=-1116,16, y=4,00, z=-1246,81], EntitySheep['Sheep'/122, l='MpServer', x=-1112,95, y=4,00, z=-1233,54]] Retry entities: 0 total; [] Server brand: fml,forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:412) at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2523) at net.minecraft.client.Minecraft.run(Minecraft.java:934) at net.minecraft.client.main.Main.main(Main.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) – System Details -- Details: Minecraft Version: 1.7.2 Operating System: Windows 8.1 (amd64) version 6.3 Java Version: 1.8.0_05, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 838425512 bytes (799 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 20006 (1120336 bytes; 1 MB) allocated, 811 (45416 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.03 FML v7.2.211.1121 Minecraft Forge 10.12.2.1121 4 mods loaded, 4 mods active mcp{9.03} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available FML{7.2.211.1121} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.2.1121.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Forge{10.12.2.1121} [Minecraft Forge] (forgeSrc-1.7.2-10.12.2.1121.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available modminecraft{1.0} [Mod Minecraft] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Launched Version: 1.6 LWJGL: 2.9.0 OpenGL: GeForce GTX 650/PCIe/SSE2 GL version 4.4.0, NVIDIA Corporation Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: [] Current Language: ~~ERROR~~ NullPointerException: null Profiler Position: N/A (disabled) Vec3 Pool Size: 443 (24808 bytes; 0 MB) allocated, 162 (9072 bytes; 0 MB) used Anisotropic Filtering: Off (1)
Il ne faut rien avoir dans le TileEntityBarriere alors ?
-
Tu as le mauvais tile entity dans le code du rendu.
Mais en fait je capte pas pourquoi tu as deux tile entity ? -
Parceque dans ce code j’ai ce TileEntityBarriere2 qui est souligné en rouge si je ne le créer pas

package mod.common; import javax.swing.Icon; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import mod.proxy.ClientProxy; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockBarriere extends Block { public BlockBarriere(int id) { super(Material.rock); } public boolean renderAsNormalBlock() { return false; } public boolean isOpaqueCube() { return false; } @SideOnly(Side.CLIENT) public int getRenderType() { return ClientProxy.renderInventoryBarriere; } protected BlockBarriere(Material material) { super(material); } public IIcon getIcon(int side, int metadata) { return ((Blocks.iron_block).getIcon(0, 0)); } @Override public TileEntity createTileEntity(World world, int metadata) { if(metadata == 0) return new TileEntityBarriere(); else if(metadata == 2) return new TileEntityBarriere2(); else return null; } public boolean hasTileEntity(int metadata) { if(metadata == 0 || metadata == 2) return true; else return false; } public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack) { int direction = MathHelper.floor_double((double)(living.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3; TileEntity te = world.getTileEntity(x, y, z); if(te != null && stack.getItemDamage() == 2 && te instanceof TileEntityBarriere2) { ((TileEntityBarriere2)te).setDirection((byte)direction); world.markBlockForUpdate(x, y, z); } } } -
WHAT ? Attends, explique moi ce que tu veux faire. Tu veux faire un ou deux blocs ? Car la ce que tu as fait actuellement c’est 2 blocs en metadata avec 2 tile entity.
-
Non donc j’ai mon block barriere qui est un modèle techne donc j’ai suivi le tutoriel pour le faire , après j’ai voulu faire en sorte que sa tourne selon la direction j’ai posté ce message car je n’y arrivais pas et tu ma dis qu’il fallait aussi suivre le tuto sur la direction des blocs pour que mon model techne se tourne selon ou je me trouve j’ai donc suivi le tuto et dans le tuto il y a deux classes apparement ce que je voudrais c’est que mon model se tourne quand je le place de la facon dont moi je suis
Désolé si je semble mal m’exprimé 
-
Les tutoriels, ils faut les lires, pas les copier/coller …
J’ai expliqué dans le tutoriel sur les directions que j’appliquais la direction à un bloc en metadata de metadata2, dans ton cas tu n’as pas de bloc avec metadata, il te faut donc un seul tile entity --’
Donc ça :@Override public TileEntity createTileEntity(World world, int metadata) { if(metadata == 0) return new TileEntityBarriere(); else if(metadata == 2) return new TileEntityBarriere2(); else return null; } public boolean hasTileEntity(int metadata) { if(metadata == 0 || metadata == 2) return true; else return false; } public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack) { int direction = MathHelper.floor_double((double)(living.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3; TileEntity te = world.getTileEntity(x, y, z); if(te != null && stack.getItemDamage() == 2 && te instanceof TileEntityBarriere2) { ((TileEntityBarriere2)te).setDirection((byte)direction); world.markBlockForUpdate(x, y, z); } }Devient :
@Override public TileEntity createTileEntity(World world, int metadata) { return new TileEntityBarriere(); } public boolean hasTileEntity(int metadata) { return true; } public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack) { int direction = MathHelper.floor_double((double)(living.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3; TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityBarriere) { ((TileEntityBarriere)te).setDirection((byte)direction); world.markBlockForUpdate(x, y, z); } }Et tu mets tout le contenu de TileEntityBarriere2 dans TileEntityBarriere et puis tu supprime TileEntityBarriere2
-
Pfiouuu , vraiment désolé j’ai lu vite pour pouvoir répondre et résoudre le problème , j’aurais pas du
Mais maintenant sa marche un grand merci à toi robin !!!
Y a t-il moyen de faire comme les escaliers ou même les barrières pour que les textures se connecte sur les coins ? Et pour la barrière qui sort de la case de l’inventaire comment faire ? 

-
Pour le rendu dans l’inventaire, je ne vois pas quoi faire à par un glScalef.
Pour les coins, il faudrait faire plusieurs modèles et choisir le modèle en fonction des blocs qui sont autours. -
Ouah ça a l’air compliquer pour les coins
Tu saurais me passer le code du dlScalef s’il te plait ? 
-
bha tu ajoute dans le code de ton rendu un G11.Scalef(x,y,z);
-
Sa ne marche pas ou que je le place et si je le place après les autres GL11 etc sa scale la barrière en jeux et pas dans l’inventaire
-
Envoi ton code de rendu
-
BarriereInventoryRenderer
package mod.proxy; import java.util.HashMap; import org.lwjgl.opengl.GL11; 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 BarriereInventoryRenderer 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; } public boolean shouldRender3DInInventory(int modelId) { return true; } @Override public int getRenderId() { return ClientProxy.renderInventoryBarriere; } }Celui-ci ?</tesrindex,></tesrindex,>
