Posted August 11, 20169 yr Hi, I want to save the data of a variable via NBTTagCompound. It doesn't work. I don't know why. What do I do wrong? Thanks! This is the simple tileentity class: http://pastebin.com/qb0b3s7Z Creator of the Master Chef Mod and many more to come. If I helped you, please click the 'thank you' button.
August 11, 20169 yr Author 1. My system.out.println(butterTime) always begins counting from 0 when I join. 2. Forgot that, placed the overrides above the methods, but it definitely overrides them. Creator of the Master Chef Mod and many more to come. If I helped you, please click the 'thank you' button.
August 11, 20169 yr Author Okay. Here it goes: The main class: http://pastebin.com/sJFRXshr The block class: http://pastebin.com/d7eiy1gZ Creator of the Master Chef Mod and many more to come. If I helped you, please click the 'thank you' button.
August 11, 20169 yr Author Ah ok. Thanks for letting me know, included my mod id. Also overrided hasTileEntity and createTileEntity, not using BLockContainer anymore. Let's see... Creator of the Master Chef Mod and many more to come. If I helped you, please click the 'thank you' button.
August 11, 20169 yr Author Nope :-(. It's very weird. Creator of the Master Chef Mod and many more to come. If I helped you, please click the 'thank you' button.
August 11, 20169 yr i had a similar issue with tile entity rotations not being saved and the block just pointing north on load. i made some changes based on an example i was able to find. primarily adding a getter and setter, rather than calling the variable directly and checking if the tagcompound.hasKey before setting it in the readfromnbt. if(par1.hasKey("direction")) { this.direction = par1.getInteger("direction"); } I don't know why either would make a difference, but one of them, at least, solved the issue.
August 12, 20169 yr In the past I know it was a good practice to use worldObj.markBlockForUpdate() as well as markDirty(). Not sure if that would make a difference. Also, you could be having a client/server desync issue, as from what I can tell, you're not syncing any fields. - Just because things are the way they are doesn't mean they can't be the way you want them to be. Unless they're aspen trees. You can tell they're aspens 'cause the way they are.
August 12, 20169 yr Author Thanks for the help. But oh well, it works suddenly, I didn't change anything. Only restarted my pc. Those weird programs... Creator of the Master Chef Mod and many more to come. If I helped you, please click the 'thank you' button.
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.