Incremental tree chopping stops after leaves no longer touch
mauritzn opened this issue ยท 3 comments
Currently the "Disable chopping if no natural leaves touch the logs" option is not exactly working for chopping down a whole tree, since it stops chopping the tree after the last log stops touching a leaf block.
Would it be possible to instead of checking if the tree is natural for each new log, to instead create a natural tree cache? So when you start chopping a tree it would check if the tree is natural, and then keep that in memory, so that even if all the leaf blocks go away it would still know that it is a natural tree.
So a simple cache either keeping track of all the natural log blocks that exists for that tree, or just the one you're chopping. The cache could then clear when you load the world, so that the cache wouldn't get to massive overtime.
I'm not sure what the outcome in certain situations would be.
Here are some problematic situations I can think of:
- Someone cuts the branches and leaves off of a tree and leaves it. How to tell if it was placed by a player instead of grown?
- Someone grows a tree next to their house and the leaves touch some player-placed logs. Is their house silently marked as a tree?
- How would this cache be vacated on a large server? Would it be fixed capacity? What if too many people try to break logs at the same time?
Perhaps we could check for leaves at some point above the logs (but leaves may decay). Another option is just to use full-chop mode instead. I just don't see a comprehensive solution other than marking all grown log blocks with a more invasive mixin, which might cause compatibility issues.
Well in the case of someone growing a tree next to their house, the shape of trees are pretty predictable, so unless the log you start chopping at conforms to a general tree shape it wouldn't be added to the cache, and only logs directly connected to the trees logs, or logs that are very close to the tree and completely surrounded by leaf blocks would be cached (caching would of course only happen on initial chopping).
Obviously a pretty robust caching solution would have to be created, since my simple clear it on world load was not really thinking of servers, and only singleplayer worlds, and even so isn't a great solution either... But I do think with enough planning a caching solution could be found.
The first situation you present would not really be an issue unless the cache has been cleared, and if enough of the tree has been removed for all the leaves to decay I wouldn't really call it a big issue, since the biggest thing this mod solves is the player not having to deal with a bunch of annoying branches, or really large trees taking a lot of effort to chop down. So I don't think a few floating logs would be the biggest pain to remove manually, although if it's a big spruce tree, then it could be a bit painful to deal with... but again only if the cache has been cleared.
I'll try and take some time and come up with a more robust caching solution that would keep servers in-mind, but since I'm quite unfamiliar with Fabric and modern Minecraft mods I am not 100% clued in on what mods are able to do on the server nor what events they can tie in-to.
Also full-chop mode feels very cheaty for me, since you can clear a giant spruce tree in like 2 seconds, so would be great if the chop time reflected at least roughly how many logs you are actually chopping down, that way it would still take roughly the same amount of time to chop down regardless of which mode you use (Efficiency enchant might want to be included in time calculation).
I guess it could be a separate mode? So that people who want the normal full-chop mode to still be a constant chop time can still get it, while those who want a more balanced one can use the dynamic one.