Jantomedes Posted April 4, 2013 Posted April 4, 2013 Hey there. I have an issue that tileentity of a block is not updating after loading a saved game but when I place a new block it is updating even after destroying the block. The code for block and tileentity: http://pastebin.com/CuCbTafE Quote
Senitiel Posted April 4, 2013 Posted April 4, 2013 As for when I place a new block it is updating even after destroying the block This snippet should resolve the issue onUpdate() { if(worldObj.getBlockID(xCoord,yCoord,zCoord)!= YourBlock.blockID) { invalidate(); } To resolve issues with TileEntity not being save, first: override hasTileEntity in BlockChainReactive (return true) and put GameRegistry.registerTileEntity(TileEntityChainReactiveRock.class, "TileEntityChainReactiveRock"); int Your mod load method. Does this work? Quote http://imageshack.us/a/img707/2757/senitielsspacemarinemod.png[/img]
Jantomedes Posted April 4, 2013 Author Posted April 4, 2013 I added the snippet and it's working. I also overrided the method (registration I already had but blocks still don't update after loading a world. I have to place them again to start them counting. Do you have any ideas? Anyway, thanks a lot ;-) Quote
Senitiel Posted April 4, 2013 Posted April 4, 2013 Hm, try to log any message in ReadFromNBT and WriteToNBT to check which one of these isn't called. But I'm not sure why it wouldn't as You have "hasTileEntity" and "createTileEntity" methods and You do TileEntityRegistration. Quote http://imageshack.us/a/img707/2757/senitielsspacemarinemod.png[/img]
Jantomedes Posted April 5, 2013 Author Posted April 5, 2013 Now I know :-) Any block with TileEntity has to implement ITileEntityProvider. I didn't see that because major of blocks with TileEntitys (all of them?) are extending BlockContainer which is implementing that. Anyway thanks for your help. Quote
Senitiel Posted April 5, 2013 Posted April 5, 2013 That's strange, because I've been using TileEntities with blocks which do not implement this interface. I wonder if that changed, gotta test my code. Quote http://imageshack.us/a/img707/2757/senitielsspacemarinemod.png[/img]
Recommended Posts
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.