[๐Ÿ“ฆ] No Unused Chunks

[๐Ÿ“ฆ] No Unused Chunks

88k Downloads

Forge 1.19 not working?

Looodon opened this issue ยท 7 comments

commented

Hey, I installed the "[(forge-1.19.x) - b0.2]" version of the mod, there was no config option under "optimize world" to clear the chunks so I assumed it should do it on its own, but I loaded a new world and flew until the world size was 90 MB (i didnt touch any blocks), I tried leaving the world and rejoining, I also restarted Minecraft and the world size never changed. The mod didn't make a config file in the config folder. I tried version b0.1 and the same thing happened. I tried the mod on an old world and a fresh new world.

Mods Installed:
AI Improvements - AppleSkin - AttributeFix - Bad Mob - Blueprint - Builders Craft & Additions - Cloth Config V8 API - Collective - Companion - Configurable Extra Mob Drops - Configured - Dungeon Crawl - Enchant with Mob - FallingTree - FPS Monitor - Friendly Griefing - Friends&Foes - Goblin Traders - Gravestone Mod - Greek Fantasy - Guard Villagers - Hunter Illager - Improved Mobs -Inventory HUD+ - Inventory Profiles Next - Just Enough Items (JEI) - JourneyMap - Kiwi - Koltin For Forge - Leashed - Let Sleeping Dogs Lie - LevelHearts - Mod Name ToolTip - NotEnoughAnimations - No Unused Chunks - Oculus - Passthrough Signs - Puzzle Lib - Rex's Additional Structures - Rubidium - Rubidium Extra - Savage & Ravage - Sound Physics Remastered - TenshiLib - Automatic Tool Swap - ToroHealth - Towns & Towers - XP Tome

commented

That's exactly how the existing unused chunk removal works in the Fabric version of the mod. When you go to to the world optimization screen, and check the "Remove unused/uninhabited chunks" box, the mod will iterate thru all chunks in all regions of a given world, and remove all chunks that have never been inhabited by a player before.

Edit:
It does that by using this following property chunks have:
Screenshot 2022-09-09 155744
More info here

commented

Oh! makes sense! I hope that someday that the forge version would be able to do that cuz it would be way easier than using MCASelector. I guess this thread is solved then! Have a nice day :)

commented

Thank you. I hope I can get this working on Forge someday as well. Have a great day as well.

commented

Hello. The reason there is no option to remove already existing unused chunks in the optimize world screen on MC Forge is because I have not yet implemented that feature. So the Forge version of the mod only features removing unused chunks as they generate while you play the game. In other words, already existing unused chunks will be untouched.

I have not implemented it yet because I have little to no experience in Forge modding, and I didn't have the time to try and figure out how to get it implemented. I will try again eventually tho. For now, I did manage to get that "discarding chunks as they generate" feature going just for the sake of having something ported to Forge. Another feature that's missing is configuring the mod via a GUI while the game is running, so eventually I need to get that going as well.

As for you generating chunks in a new world until reaching 90mb, the mod was already discarding unused chunks. Once you leave the world, the game will save the world data into it's region files, and will not save chunks you or another block/entity ever touched. So you probably ended up generating what would be worth more than 90mb without the mod, but 90mb with the mod. Try generating the same chunks without using the mod, and then compare the sizes. That feature of course cannot prevent 100% of unused chunks from being saved, so the world size will keep increasing as you move around. I just generated* an 18x18 area in a new 1.18.2 world (seed: 6688559849756812735), and the size was around 15mb with the mod, but 25mb when i loaded those same chunks without the mod.

As for the config file not being generated, that is because the Forge version of the mod uses the default configuration (by default it is enabled). If you wish to override that, you can create the config file manually and configure the mod from there.

Sorry for any inconveniences this may have been, and have a good day.
Edit: grammar fixes

commented

There are no inconveniences at all, thank you for the quick response! I thought that the mod wasn't working because when i would stand next to a horse for example or a villager in an untouched chunk and start the game again, they would be in the same spot which makes me wonder: 1) are entities not deleted with the chunks and regenerated if I didn't attack it or are entities not included in this? 2) If I kill a mob will the chunk be counted as "touched and needs saving"? because that helps me know if i can kill mobs that dont naturally respawn without worrying about if they'll disappear forever. If you don't know the answer it's okay!

Thank you! ๐Ÿ‘

EDIT: I did the test of starting a new world with the same seed and flying the same distance. I opened both worlds with MCASelector which views the world maps/chunks and it shows both loaded equally the same. I opened both region files and its the same amount of files, yet the file size is a bit smaller, which is confusing me

commented

Regarding how chunks are saved/loaded, that is defined by the game itself, and not the mod. All the mod does is tell the game not to save a given chunk as soon as it generates. I will give my thoughts on what I think happens tho (I could end up being wrong):

  1. When a chunk is saved, all of the entities in the same chunk are saved as well. If not, then the entities are discarded. If an entity walks out of an unused chunk into a used chunk, it will get saved., but.. it will not regenerate the next time the unused chunk regenerates, as Minecraft keeps track of Entity UUIDs and which entities already exist.
  2. If you kill an entity, the entity emits a game event using emitGameEvent(GameEvent.ENTITY_KILLED); that is then picked up by the world and the chunks in it. I tried looking into what those event handles are, but I didn't manage to find anything. I assume one of the event handlers then mark the chunk as "needs saving".
  3. As for the edit, each region file contains the chunks that are in that region. The game will always create the same region files regardless of what chunks get saved or not. So I think that one group of region files is smaller because even tho the game created them, it did not save as much chunk data in them.
    Again, I am not 100% sure about how Minecraft handles this stuff in the background, but there are my thoughts about how I think it works.
commented

I don't know anything about modding, but one extra way a mod might be able to delete useless chunks is by how much time someone spent in them instead even if they do interact with it. MCASelector has an option like that except its not a mod. Idk if that's a good suggestion, but if it's easy I definitely think would be a game changer!

Thank you for your time and the help!