Jump to content

How chunk loading works ?


Blackout

Recommended Posts

Hi, could you explain me how Chunk is loaded ?

 

For my mod, I save all removed block from an explosion to restore it later. I currently work on serialization to save unrestored blocks when server shutdown.

 

My first idea was storing in world.perWorldMapStorage a Map<Chunk, File> for "affected chunk ==> file where is stored explosion data" (1 file = 1 explosion, because I can have dependencies from other chunk to replace block in a good order) and create a file when an explosion occurs then store in json format data I need then save the file in "world directory/myMod/custom_name_timestamp.json". Create an engine to load and unload explosion data when chunk is loaded/unloaded.

 

But it doesn't seen to be the best practice. Next I thought about creating an Entity which could contains my explosion data. So loading and unloading will be implemented by Minecraft code. Something less to do and maintains :D

 

However to do that I need to know how chunk loading/unloading works. Let me explain with an example :

 

I have a big explosion of 10 chunks. My entity is located in the middle of the explosion area. When entity is loaded block are progressively restored. But if entity is located in chunk loaded border, I have 5 chunk loaded and 5 chunk unloaded. When I want to restore a block located in a unloaded chunk, is this chunk loaded then immediately unloaded ? So if my next restoring is a block in this chunk, it will be loaded and unloaded again ?

 

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.