Only remove worldgen block entity on changed block #10794
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The previous PR #10375 removes block entities on setBlock calls to the WorldGen region to prevent the existence of a block entity on a block that does not support it as such.
The logic however assumed that such calls would always follow the order of:
This is however not the case for all of world gen, specifically not for structure templates being placed under water, as these first set the block state, then configure its block entity (include the chests lootable) and finally waterlogs the chest by calling another setBlock.
To prevent this logic from deleting the original block entity, this commit now only removes the block entity found if the blockstate to be set differs from the previous one, matching LevelChunk#setBlockState.
Supersedes: #10768
Fixes: #10750