Dynamic Trees

Dynamic Trees

25M Downloads

Ponds generate under trees

naqaden opened this issue ยท 8 comments

commented

screenshot

commented

This should be handled with the new sloppy breaking handler. I haven't seen any evidence of this happening in a while.

commented

I searched and found evidence this is indeed fixed: wood blocks in a freshly gen'd lake. Nice work!
screenshot

commented

Any other mods other than Dynamic Trees?
And which versions are all your mods?

commented

In that screenshot yes, but I found trees like this in tests with only DynamicTrees-1.12.2-0.8.2.

commented

@naqaden that's correct. I've known about this bug for a while just didn't know how to go about fixing it since the lakes generate after trees.

commented

When Minecraft generates lakes it makes a 16x8x16 boolean buffer structure and places it in a random location within the 2x2 chunk population area. The algorithm fills the top 4 blocks of the structure with air and the lower 4 blocks with water(or whatever liquid the LakeGenerator is assigned). The problem is that although this generation event occurs before trees are built it can still erase blocks from already populated chunks with trees in them. Apparently this happens with vanilla trees as well. There's 2 solutions that I can see and neither are any good. The first is that the lake generator will bail out before making a lake if it detects liquid or non-solid blocks where the lake would be created. A sacrificial block could be created under the rooty dirt that reports itself as non-solid to jam the lake creation and prevent one from forming at all. The second is to override the lake generator with a rewritten one that more carefully analyzes the surroundings. This would involve making a core mod and replacing the lake generator class. Both of these solutions suck. The first causes very few lakes to form and makes a useless block that is bound to break something else. The second is a compatibility nightmare since core mods are generally regarded as a bad idea. Mods expect the MC code to behave a certain way and core mods make up a bulk of the incompatibility issues we all experience. It is for these reasons that until further notice I'm considering this not fixable.

Maybe if forge had a "post lake" event that included the coordinates and the boolean array the lake was built from then it could be used to clean up any damaged structures.

commented

Fair enough. Not that this occurrence is a huge deal anyway, but to throw another idea out there - would it be expensive for trees to look for their rooty dirt block post-lake-gen, and fall or despawn if not present?

commented

Yes. Since this would require that all branches be tick-able and relentlessly make that check. Currently branches don't tick. There's a lot of branches. I would say it's inadvisable since the greatest performance gain I made with DT involved making the branches no longer tick.

Edit: When I say "tick" what I mean is "randomly update"