aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPierpaolo Coletta <[email protected]>2024-04-06 23:16:54 +0200
committerGitHub <[email protected]>2024-04-06 17:16:54 -0400
commit06361fa662d82745f26642c79a20db82acbb8c30 (patch)
tree514352e0d14210523d548fe9b1cfd5e9e9aeb783
parenta774fbaca8fb88750dac58c5beedd4c906d5a09c (diff)
downloadPaper-06361fa662d82745f26642c79a20db82acbb8c30.tar.gz
Paper-06361fa662d82745f26642c79a20db82acbb8c30.zip
Fix invalid block entities created during world gen (#10375)
-rw-r--r--patches/server/1053-Fix-creation-of-invalid-block-entity-during-world-ge.patch40
1 files changed, 40 insertions, 0 deletions
diff --git a/patches/server/1053-Fix-creation-of-invalid-block-entity-during-world-ge.patch b/patches/server/1053-Fix-creation-of-invalid-block-entity-during-world-ge.patch
new file mode 100644
index 0000000000..5f6f4e6b9c
--- /dev/null
+++ b/patches/server/1053-Fix-creation-of-invalid-block-entity-during-world-ge.patch
@@ -0,0 +1,40 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Pierpaolo Coletta <[email protected]>
+Date: Sat, 30 Mar 2024 21:06:10 +0100
+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 5ece375eaf6bcc61864997a389bb5e24625e4505..9c3f8f79c2b3389a118dce9a1558edda52446833 100644
+--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
++++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
+@@ -352,6 +352,7 @@ public class WorldGenRegion implements WorldGenLevel {
+ ichunkaccess.removeBlockEntity(pos);
+ }
+ } else {
++ ichunkaccess.removeBlockEntity(pos); // Paper - Clear the block entity before setting up a DUMMY block entity
+ CompoundTag nbttagcompound = new CompoundTag();
+
+ nbttagcompound.putInt("x", pos.getX());
+diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+index 6ec3fc801453fd54c25b642e6fa71c19b463311d..465458e8a7dbaf9afb32709a71c7b2620d1e1fd2 100644
+--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
++++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+@@ -1169,9 +1169,14 @@ public class LevelChunk extends ChunkAccess {
+ if (this.blockEntity.getType().isValid(iblockdata)) {
+ this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), iblockdata, this.blockEntity);
+ this.loggedInvalidBlockState = false;
+- } else if (!this.loggedInvalidBlockState) {
+- this.loggedInvalidBlockState = true;
+- LevelChunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", new Object[]{LogUtils.defer(this::getType), LogUtils.defer(this::getPos), iblockdata});
++ // Paper start - Remove the Block Entity if it's invalid
++ } else {
++ LevelChunk.this.removeBlockEntity(this.getPos());
++ if (!this.loggedInvalidBlockState) {
++ this.loggedInvalidBlockState = true;
++ LevelChunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", new Object[]{LogUtils.defer(this::getType), LogUtils.defer(this::getPos), iblockdata});
++ }
++ // Paper end - Remove the Block Entity if it's invalid
+ }
+
+ gameprofilerfiller.pop();