Jump to content

Can someone explain how/when chunk unloading occurs?


MrChoke

Recommended Posts

I'd like to understand more about how chunk unloading occurs.  Take for example some custom mobs that are moving around under new AI I wrote.    I have them set to never despawn.  But I am assuming they will *pause* their movement when the chunk unloads and resume when the chunk comes back.  Can someone explain how that works?  

 

Thanks.

Link to comment
Share on other sites

Yes, they "pause" because the chunk they are in ceases to exist (and thus, so do they). All* data is serialized and when the chunk loads again that data is deserialized and everything ends up in the same state that it was left in.*

 

*Note: Not literally all data is serialized, eg. pathing information is not and is instead recomputed when needed again.

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 comment
Share on other sites

3 minutes ago, Draco18s said:

Yes, they "pause" because the chunk they are in ceases to exist (and thus, so do they). All* data is serialized and when the chunk loads again that data is deserialized and everything ends up in the same state that it was left in.*

 

*Note: Not literally all data is serialized, eg. pathing information is not and is instead recomputed when needed again.

Ok, good to know that it reads/writes to file.  Do you know when a chunk unloads?

 

Link to comment
Share on other sites

15 minutes ago, MrChoke said:

Do you know when a chunk unloads?

If it is not being manually kept loaded, ie spawn chunks or chunk loader. Then once they are a distance away from the player they unload, in singleplayer it is the render distance (I believe) in multiplayer it's a "render distance" that is specified in the server.properties file.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

48 minutes ago, Animefan8888 said:

If it is not being manually kept loaded, ie spawn chunks or chunk loader. Then once they are a distance away from the player they unload, in singleplayer it is the render distance (I believe) in multiplayer it's a "render distance" that is specified in the server.properties file.

OK, yeah, read on the wiki, it says render distance.  So chunk loaders, I see a ChunkLoader class in the minecraft code.  Do we use that to keep chunks loaded or does Forge have some other way?

 

Thanks.

Link to comment
Share on other sites

3 hours ago, Animefan8888 said:

If it is not being manually kept loaded, ie spawn chunks or chunk loader. Then once they are a distance away from the player they unload, in singleplayer it is the render distance (I believe) in multiplayer it's a "render distance" that is specified in the server.properties file.

I believe it’s the “render distance” + 2, I could be wrong as I can’t remember where I got this information from though

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

2 hours ago, MrChoke said:

OK, yeah, read on the wiki, it says render distance.  So chunk loaders, I see a ChunkLoader class in the minecraft code.  Do we use that to keep chunks loaded or does Forge have some other way?

 

Thanks.

I believe there is a class called ForgeChunkLoader or ForgeChunkManager? That allows you to do something with them. I'm not really sure.

  • Thanks 1

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

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.