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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello all! I'm currently trying to make the Biomes o' Plenty mod (1.12.2 version) compatible with my shaderpack (BSL v8.5). Even after I've already inserted a "shaders" folder with a correctly-formatted blocks.PROPERTIES file within the assets folder of the .jar, it still does not wave the textures from the mod. I definitely thought this was going to work since I noticed the 1.19.2 version of the mod laid it out exactly like that and it worked perfectly when my PC was able to run 1.19.2 Forge... ^^;;; Could there be some missing link I'm not getting at here?
    • After much experimentation I finally realised why this doesn't work and how to fix it. The critical component to understand here, is that ItemCraftedEvent is called before the crafting ingredients are purged from the crafting slots; this all happens in ResultSlot.java's onTake method: We can see here the first line fires checkTakeAchievements, this is what fires the ItemCraftedEvent (after a few method calls). Then we can see the purge behaviour. I worked around this by creating a CarverItem class, which uses hasCraftingRemainingItem and getCraftingRemainingItem to hook into ResultSlot.onTake: Now, I reconstruct my ItemCraftedEvent handler, and using some smart tags (which I omit for brevity), I handle two cases: 1. When crafting a carved item, I damage the tool used in the recipe 2. When crafting a carving tool from a repair recipe, I manually purge the input tools as with the new CarverItem class, as otherwise items would be duplicated   This has now greatly improved implementation, beyond my expectations, for the standard crafting table and the user's inventory crafting grid. A user can now click or shift-click 'carve' items, with no duplication or issues that I have spotted so far.  
    • Hi, I'm having issues launching my Forge 1.20.1 installation (47.2.0). I keep getting error code 1, and all the logs abruptly pause with the game attempting to open GL 4.6. Latest Crash: https://pastebin.com/zsP5Wipk Debug (No idea what the real name is) Log: https://pastebin.com/CzvqhNq0   Thanks for the help!
    • In the most up to date version of Allthemods 6 (v1.9.2) the stoned bee is not able to be interacted with apart from putting it into an empty bee jar. I can't breed the bee or put it into my aviary breeder. When I try to put it into the breeder it says import unsuccessful. The stoned bee is one of the most important bees for advancing in the mod so it is rather unfortunate that it is not working as intended.
    • Everytime I try to run the Forge 1.20.1 - 47.1.0 Installer, only appears an a black window and then closes. I don't appear the installing menu anymore.
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.