diff options
Diffstat (limited to 'patches/server/0966-Fix-creation-of-invalid-block-entity-during-world-ge.patch')
-rw-r--r-- | patches/server/0966-Fix-creation-of-invalid-block-entity-during-world-ge.patch | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/patches/server/0966-Fix-creation-of-invalid-block-entity-during-world-ge.patch b/patches/server/0966-Fix-creation-of-invalid-block-entity-during-world-ge.patch index a745081446..2b1eed9161 100644 --- a/patches/server/0966-Fix-creation-of-invalid-block-entity-during-world-ge.patch +++ b/patches/server/0966-Fix-creation-of-invalid-block-entity-during-world-ge.patch @@ -5,14 +5,33 @@ Subject: [PATCH] Fix creation of invalid block entity during world generation diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java -index a59eece9c7a8c33cb8ce963906e993c3462684fb..333a02e08cccf5cb0efa2076582cbd69e95ff0c0 100644 +index a59eece9c7a8c33cb8ce963906e993c3462684fb..386fbf79afe91af445f54aeab7d1296d1407a4d8 100644 --- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java +++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java -@@ -339,6 +339,7 @@ public class WorldGenRegion implements WorldGenLevel { +@@ -323,7 +323,7 @@ public class WorldGenRegion implements WorldGenLevel { + return false; + } else { + ChunkAccess ichunkaccess = this.getChunk(pos); +- BlockState iblockdata1 = ichunkaccess.setBlockState(pos, state, false); ++ BlockState iblockdata1 = ichunkaccess.setBlockState(pos, state, false); final BlockState previousBlockState = iblockdata1; // Paper - Clear block entity before setting up a DUMMY block entity - obfhelper + + if (iblockdata1 != null) { + this.level.onBlockStateChange(pos, iblockdata1, state); +@@ -339,6 +339,17 @@ public class WorldGenRegion implements WorldGenLevel { ichunkaccess.removeBlockEntity(pos); } } else { -+ ichunkaccess.removeBlockEntity(pos); // Paper - Clear the block entity before setting up a DUMMY block entity ++ // Paper start - Clear block entity before setting up a DUMMY block entity ++ // The concept of removing a block entity when the block itself changes is generally lifted ++ // from LevelChunk#setBlockState. ++ // It is however to note that this may only run if the block actually changes. ++ // Otherwise a chest block entity generated by a structure template that is later "updated" to ++ // be waterlogged would remove its existing block entity (see PaperMC/Paper#10750) ++ // This logic is *also* found in LevelChunk#setBlockState. ++ if (previousBlockState != null && !java.util.Objects.equals(previousBlockState.getBlock(), state.getBlock())) { ++ ichunkaccess.removeBlockEntity(pos); ++ } ++ // Paper end - Clear block entity before setting up a DUMMY block entity CompoundTag nbttagcompound = new CompoundTag(); nbttagcompound.putInt("x", pos.getX()); |