Paper/patches/server/0107-Option-to-remove-corrupt-tile-entities.patch

47 lines
2.2 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Wed, 5 Oct 2016 16:27:36 -0500
Subject: [PATCH] Option to remove corrupt tile entities
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 6324c3465cf34cea2e7fd7d8c26a0cbeeb20eefd..097991f2dd8d35fd5bc62e23e7361d47e70da493 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -342,4 +342,9 @@ public class PaperWorldConfig {
2021-06-11 14:02:28 +02:00
preventTntFromMovingInWater = getBoolean("prevent-tnt-from-moving-in-water", false);
log("Prevent TNT from moving in water: " + preventTntFromMovingInWater);
}
+
+ public boolean removeCorruptTEs = false;
+ private void removeCorruptTEs() {
+ removeCorruptTEs = getBoolean("remove-corrupt-tile-entities", false);
+ }
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
2021-11-23 14:22:49 +01:00
index e641779c58b503c88cb533a45a3614f45c4b8fa3..805101792508bd721dd38fb57514f7f21bd90504 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
2021-11-23 14:22:49 +01:00
@@ -261,7 +261,7 @@ public class LevelChunk extends ChunkAccess {
}
this.setLightCorrect(protoChunk.isLightCorrect());
- this.unsaved = true;
+ this.setUnsaved(true);
this.needsDecoration = true; // CraftBukkit
}
@@ -579,6 +579,12 @@ public class LevelChunk extends ChunkAccess {
2021-06-12 08:02:49 +02:00
"Chunk coordinates: " + (this.chunkPos.x * 16) + "," + (this.chunkPos.z * 16));
2021-06-11 14:02:28 +02:00
e.printStackTrace();
ServerInternalException.reportInternalException(e);
+
2021-06-12 08:02:49 +02:00
+ if (this.level.paperConfig.removeCorruptTEs) {
2021-06-11 14:02:28 +02:00
+ this.removeBlockEntity(blockEntity.getBlockPos());
2021-11-23 14:22:49 +01:00
+ this.setUnsaved(true);
2021-06-11 14:02:28 +02:00
+ org.bukkit.Bukkit.getLogger().info("Removing corrupt tile entity");
+ }
// Paper end
// CraftBukkit end
}