Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

NBT request, and saving/ loading private data

Recommended Posts

In my mod i need to be able to load an unload these Chunks of Chunks essentially. The 'chunk-chunks' contain 4096 objects that hold the variables that represent different surface temperatures and such for each minecraft chunk. So that when a function need say the percentage of the surface of a certain chunk covered in water block, surface temperature (which is defined by time of year and light level) it will be able to call on one of the "chunks". The problem is i don't know how to load and unload each of the chunk-chunks at any given time. Holding them all in the computers memory is completely absurd. How will i be able to call the nbt that I need if one of these chunk-chunks come into render distance.

Link to post
Share on other sites

Just as a pre-emptive warning:

These events do not fire in a consistent* way and these events are asynchronous, meaning that any data structures you use to track data will need to be thread-safe or you'll get concurrent modification errors.


*By which I mean "use this for X and that for Y."  There are two Save events fired when a chunk unloads, called from different points in the code.  One of those points is after a chunk has been marked as unloaded and will see the chunk removed from memory.  The other is simply a write-to-disk pass and the chunk may or may not be on its way to being unloaded.

The best way I've found to handle clearing data from ram for when a chunk unloads is to use the Save event and check


Likewise, the Unload event doesn't give you access to the chunk NBT to save anything.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.


Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.


DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to post
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.

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.

  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.