Jump to content

[1.16.5] Error when save TileEntity data (ListNBT)


Luis_ST

Recommended Posts

As already stated in the title, I have problems saving my custom tileentity data,
the saving itself works, but when I change the data I close the world and open it again I get an error message (see log).

What I don't understand about it when loading the world,
the save method should not be called in my tileentity because the data should actually be loaded.
why is the method called?

 

this is my TileEntity
this is the log:

error log.log

Link to comment
Share on other sites

45 minutes ago, diesieben07 said:

You are calling it yourself, here:

okay makes sense, but how do I prevent the tileentity data from being updated before it is not loaded?
in the forge doc to synchronize tileentity data it is checked whether the area is loaded, includes this also the data of the tileentity?

45 minutes ago, diesieben07 said:

You increment i every loop, but only add to the ListNBT if the element is not null. So if for example the first element is null, on the 2nd loop i will be 1 and the ListNBT will be empty. You then tell the ListNBT to add at position 1, which it does not have (it's still empty). Do not use the add(int, T) method. Just use a normal foreach loop and add(T).

I had used add(i, T) to save the order of the list, but in the end it would not change anything in the function of the tileentity...

Edited by Luis_ST
Link to comment
Share on other sites

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.