Jump to content

Recommended Posts

Posted

This is the first time i try to mess with minecraft chunk loading, and i'd just like to get a little feedback on this problem (not asking for code examples 😁). I am implementing an entity that can spawn anywhere in the world (maybe in a certain radius around the player), it will have a relatively short life span and a fixed direction vector. However i need it to always be processed, from when it spawns to when it leaves the world, no matter where the player is relatively to the entity. Also the entity can interact with the world, destroying the blocks it finds in its path until it reaches its destination and damaging living entities it collides with. After diving a bit into the code that manages chunks the first and simpler solution that came to my mind was simply to force load the chunk the entity is in and the next chunk it will traverse based on its direction (to avoid the entity entering an unloaded chunk and thus stop being updated). Then when the entity dies i just force unload only the chunks that were loaded by the entity, because there may be chunks that were already loaded by something else for whatever reason. The chunk loading and storing should be implemented in the form of a world capability i guess, and internally would just replicate what the /forceload command does. So the question is: would this be the the best or most efficient way to achieve something like that? And is there something else i should take into account to not create issues when force loading/unloading chunks?

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

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.