-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix invalid block entities created during world gen (#10375)
- Loading branch information
1 parent
a774fba
commit 06361fa
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
patches/server/1053-Fix-creation-of-invalid-block-entity-during-world-ge.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Pierpaolo Coletta <p.coletta@glyart.com> | ||
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(); |