Skip to content
This repository has been archived by the owner on Dec 25, 2023. It is now read-only.

[Suggestion] Option to disable specific world actions causing saves on new chunks #14

Open
RandomGgames opened this issue Mar 30, 2023 · 3 comments
Labels
Suggestion A feature request or some other suggestion.

Comments

@RandomGgames
Copy link

When a new chunk is generated, sometimes water/lava starts flowing or gravel will fall. I have a sneaking suspicion that these are causing chunks that would otherwise delete themselves and aren't needed to be saved.

That or I have a mod installed that is interfering with this mod... There are regions of my world that should be completely empty with this mod installed because I've only flown through them, yet they exist.

@TheCSDev
Copy link
Member

Hello!
I believe you are right when it comes to block updates taking place right after chunk generation, such as flowing liquids and falling blocks. I had that on mind when writing this mod as well, so this very likely is the case. Another thing to have in mind is newly generated mobs triggering block updates, such as sheep eating grass and endermen picking up blocks right as they generate. Just the sole existence of mobs that spawn in (maybe?) might trigger a save (not 100% sure regarding that tho, just guessing).

While the feature you suggested is a good idea, I think it may be a bit too difficult for me to implement, as I do not know what parts of the game's source code trigger chunk saves and how they work, although it can be done I believe.

Another thing I wanna mention, I am concerned about how such a feature could affect a world, or more specifically, break a world.. because the feature would then have to somehow track and "guess" what happened on "its own" and what was "player-influenced".
Like for example, what if I launched a TNT cannon into an ungenerated chunk or sent off a flying machine there, and then when the chunk finally generates, this mod assumes the redstone stuff that got there was not "player-influenced", and therefore it "discards" the chunk and casuses the player "lose prgress" (if you get what I mean). Although, given that redstone stuff triggers block updates that then trigger chunk saves, this concern might be a non-issue.

So overall, nice suggestion, might look into it in the future. Have a great day as well!

@TheCSDev TheCSDev added the Suggestion A feature request or some other suggestion. label Mar 30, 2023
@RandomGgames
Copy link
Author

I definitely get the loss of progress worry. I thought about that too but simple things like falling gravel or sheep eating could be ignored. Fire maybe not for example (especially when clearing forests for example)

If you do wish to tackle this in the future, I would definitely appreciate it. If not, no big deal. I have never made a mod and I can only imagine having to look through the docs for hours, testing, trying to get this feature to work. But if you got it to work for one chunk update (sheep eating for example) maybe it would be easy to add for others?

Thanks! I hope you do in the future but if not, not a big deal. You have a great day too!

@TheCSDev
Copy link
Member

I can only imagine having to look through the docs for hours, testing, trying to get this feature to work.

If only there were any docs out there, becuase most of the time there are no resources out there, and when you do find something, it's outdated and no longer works. So most of my modding has been just looking through the game's code and figuring out how stuff works on my own.
I mean, sure, Fabric and Forge have basic docs resources for getting started when diving into modding for the first time, but if you ever need to know "How to make the game do X when Y happens", you're mostly on your own. Tho at least the Forge mod loader has its own APIs, and Fabric has a bunch of API mods that can help mod developers.

Anyways, sorry for getting off-track for a bit there. Regarding simple things like falling gravel after chunk gen. or sheep eating, as you mentioned, those can definitely be safely ignored I believe.

I should also look into whether or not such things cause the "inhabited time" flag to increase. That flag basically tracks how much influence players had over chunks, which is what this mod and other similar programs and tools also use to discard unused chunks.
If for example gravel falling on its own does not increase "inhabited time", then that'd be great, as the chunk could then be safely discarded knowing for sure that the player had no influence over the chunk.

Just thought I'd mention those.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Suggestion A feature request or some other suggestion.
Projects
None yet
Development

No branches or pull requests

2 participants