Jump to content

Recommended Posts

Posted

I'm looking for a way how to save nbt data to the dimension/player/all worlds?

 

So far I found out that entity has getEntityData, but it cannot be used to save data for a player (after death it disappears).

 

I saw that in changlog it is mentioned (per-dimension), but is there any documentation for forge (not javadoc, I can browse through classes in my IDE, but without knowledge of class/method names it's useless)? Tutorials on forge wiki do not cover much :/

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

Posted

Thank you for fast answer. My mod isn't a core one, is there any other way of storing save-specific or dimension-specific data?

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

Posted

My method of storing persistent data for worlds, while not being a coremod, is to sideline a data file into the world-save folder, and to use onWorldSave and onWorldLoad events to trigger loading/saving of the data.  I use basically an NBT tag to store it in, and CompressedStreamTools to write it into a file.  A little code for a timestamp (don't want to re-load old data when a new dimension is loaded/reloaded) ,and clearing cache on logout, and you've got a persistent-data system running alongside MC that will load world-specific data.

 

It is kind of ugly, and relies on that file not being separated from the world directory, but it has worked very well for me so far.  Many other mods to the same (or very similar)--e.g. Greg-tech stores IDSU values in such a file, NEI stores world-inventory-saves into such a file--WRCBE stores world-specific frequency info in much the same manner. 

 

For examples of how these work, ChickenBones does release source for his mods, which should show you how/when to load the data.

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.