pmdevita / CreeperHeal2

Spigot plugin to automatically patch creeper holes and more
GNU Affero General Public License v3.0
6 stars 2 forks source link

Snowfall during large explosions creates duplicate block replacement #7

Open pmdevita opened 3 years ago

pmdevita commented 3 years ago

In large TNT explosions, Minecraft stages the TNT in turns to prevent simulating every explosion at once, which would be incredibly expensive to calculate in a few ticks.

However, this means the game continues while the rest of the explosions go off. And in snowy biomes this can result in snow layers accumulating on top of an explosion crater, only for another explosion to come along and add it into the merged explosion.

The result then is that both the snow layer and the original block are replaced. Whichever one is last in queue will remove the first block.

This is potentially expensive to correct, this kind of thing can only happen in large explosions so already there are a ton of blocks to check. Before a solution is devised for this, it would be good to get a list of similar situations so a single solution be can designed to cover all of them.

pmdevita commented 7 months ago

Had an idea: Older Explosion is A, newer Explosion is B Prior to merge, check B's bounding box for a biome that can snow. If found, take the intersection of B and A's locations. For each block in intersection, double check if B's is a snow block. If so, delete it and dump out any dependencies into the main block list.

If this is done in async outside of the game thread the performance hit might be fairly acceptable.