Paper/Spigot-Server-Patches/0141-Option-to-remove-corrupt-tile-entities.patch
Aikar 2365b308c8
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly.

This update has been tested to ensure that World Conversion still occurs correctly.

Bukkit Changes:
0812ce2c SPIGOT-4397: isChunkGenerated API

CraftBukkit Changes:
4824655c SPIGOT-4398: Upgrade to ASM 6.2.1 for better Java 11 support
eea43870 MC-134115: Fix issues converting tile entities
1a7f2d10 SPIGOT-4397: isChunkGenerated API
40aed54d SPIGOT-4396: Improve vehicle movement

Spigot Changes:
f6a273b1 Rebuild patches
2018-09-26 22:35:46 -04:00

49 lines
2.2 KiB
Diff

From ed6c926fa07218cd3d49a058c7f2615aa0e18f9d 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 c43152f456..0d456bcbac 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -326,4 +326,9 @@ public class PaperWorldConfig {
private void maxAutoSaveChunksPerTick() {
maxAutoSaveChunksPerTick = getInt("max-auto-save-chunks-per-tick", 24);
}
+
+ public boolean removeCorruptTEs = false;
+ private void removeCorruptTEs() {
+ removeCorruptTEs = getBoolean("remove-corrupt-tile-entities", false);
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index c76be9c668..a8705776a6 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -839,6 +839,12 @@ public class Chunk implements IChunkAccess {
"Chunk coordinates: " + (this.locX * 16) + "," + (this.locZ * 16));
e.printStackTrace();
ServerInternalException.reportInternalException(e);
+
+ if (this.world.paperConfig.removeCorruptTEs) {
+ this.removeTileEntity(tileentity.getPosition());
+ this.markDirty();
+ org.bukkit.Bukkit.getLogger().info("Removing corrupt tile entity");
+ }
// Paper end
// CraftBukkit end
}
@@ -848,6 +854,7 @@ public class Chunk implements IChunkAccess {
this.h.put(new BlockPosition(nbttagcompound.getInt("x"), nbttagcompound.getInt("y"), nbttagcompound.getInt("z")), nbttagcompound);
}
+ public void removeTileEntity(BlockPosition blockposition) { this.d(blockposition); } // Paper - OBFHELPER
public void d(BlockPosition blockposition) {
if (this.i) {
TileEntity tileentity = (TileEntity) this.tileEntities.remove(blockposition);
--
2.19.0