Jump to content

Recommended Posts

Posted

So I want to save the data for a TileEntity, just a couple integers and a boolean, first time trying with goals of success to save the data with NBT, but, should I use them? Or the new Capabilities system is the way to go for storing TileEntities data?

Come and say hi at www.twitter.com/JoseluGames

Posted

No the Capabilities are for stuff thats similar to other tile entities and stuff that should be compatible with other mods (like Inventory, FluidTank , ...)

Normal data (as you sayed some integer and booleans) are still stored in NBT with the writeToNBT() and readFromNBT() method

Posted

What's strange is that your #getUpdatePacket method is not being called at all according to the log, and thus #onDataPacket is not, either... but #writeToNBT and #readFromNBT are both called...

 

Can you show where you register your TileEntity and the related Block class? Perhaps some more context will help track down the issue.

 

Another thing you can try if you haven't already is updating Forge - sometimes things get broken temporarily, and though I don't have any reason to believe that's the case here, it's worth a shot.

Posted

In 1.9.4+, you need to override

TileEntity#getUpdateTag

to write the data that needs syncing to a compound tag and return it. You should then override

TileEntity#getUpdatePacket

to use the compound tag returned by

TileEntity#getUpdateTag

.

 

TileEntity#getUpdateTag

is sent with the chunk data,

TileEntity#getUpdatePacket

is sent after that.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

i cant get mine to work either, tried setting what you said overridden in my tile entity extended from TileEntity but writeInternal is set to private. or do i have to make my own TileEentity class. cant really find any examples of working code either, im just trying to store one item and every other part of my code works but this.

Posted

i cant get mine to work either, tried setting what you said overridden in my tile entity extended from TileEntity but writeInternal is set to private. or do i have to make my own TileEentity class. cant really find any examples of working code either, im just trying to store one item and every other part of my code works but this.

 

Call

super.getUpdateTag

from your override of

TileEntity#getUpdateTag

.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.