Skip to content

Commit

Permalink
Obfhelper
Browse files Browse the repository at this point in the history
  • Loading branch information
lynxplay committed May 26, 2024
1 parent e3286da commit d7e3575
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@ 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..aa038aef5e73f35089698202410de1e0b56514a1 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
@@ -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);
}
Expand All @@ -19,7 +28,7 @@ index a59eece9c7a8c33cb8ce963906e993c3462684fb..aa038aef5e73f35089698202410de1e0
+ // 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 (iblockdata1 != null && !java.util.Objects.equals(iblockdata1.getBlock(), state.getBlock())) {
+ 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
Expand Down

0 comments on commit d7e3575

Please sign in to comment.