Posted July 20, 201510 yr Hello I want to destroy a chest to replace it later. All about TileEntity is normally fixed, but I'm still stuck with metadata. When I use this configuration : it works, but when I use this one : So without a solid block beetween, I got this : All chest are to the south direction BUT metadata are good. It looks like metadata is ignored How can I solve it ?
July 20, 201510 yr Author @SubscribeEvent public void onWorldTick(TickEvent.WorldTickEvent event) { ... ... world.setBlock(blockData.getChunkPosition().chunkPosX, blockData.getChunkPosition().chunkPosY, blockData.getChunkPosition().chunkPosZ, blockData.getBlock(), blockData.getMetadata(), 7); ... } @SubscribeEvent public void onDetonate(ExplosionEvent.Detonate event) { ... worldHealer.add(new BlockData(world,c), ticks); ... } public class BlockData { private Block block; private int metadata; private NBTTagCompound tileEntityTag; private ChunkPosition chunkPosition; public BlockData(World world, ChunkPosition chunkPosition) { this(world.getBlock(chunkPosition.chunkPosX, chunkPosition.chunkPosY, chunkPosition.chunkPosZ)); this.chunkPosition = chunkPosition; this.metadata = world.getBlockMetadata(chunkPosition.chunkPosX, chunkPosition.chunkPosY, chunkPosition.chunkPosZ); TileEntity te = world.getTileEntity(chunkPosition.chunkPosX, chunkPosition.chunkPosY, chunkPosition.chunkPosZ); if(te != null) { this.tileEntityTag = new NBTTagCompound(); te.writeToNBT(tileEntityTag); } } I have a lot of code, so I can't put all here else it will be unundestandable. I've tried to focus on important parts. I hope it's enought, but I can put more code if you want. I'm sure block metadata is correct before calling world.setBlock(blockData.getChunkPosition().chunkPosX, blockData.getChunkPosition().chunkPosY, blockData.getChunkPosition().chunkPosZ, blockData.getBlock(), blockData.getMetadata(), 7); Because I've done a System.out.println() of blockData.getMetadata() just before and I have correct values.
July 20, 201510 yr Author It works Weird idea indeed Anyways, thank you very much Fortunately there are people like you who know the subtleties of the minecraft's code
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.