From 7d678709056109b64e0b11f1e140f4d9bcbe7331 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Sat, 15 Jun 2019 10:30:43 -0700 Subject: [PATCH 1/3] Show blockstate location if we failed to read it --- ...ate-location-if-we-failed-to-read-it.patch | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Spigot-Server-Patches/Show-blockstate-location-if-we-failed-to-read-it.patch diff --git a/Spigot-Server-Patches/Show-blockstate-location-if-we-failed-to-read-it.patch b/Spigot-Server-Patches/Show-blockstate-location-if-we-failed-to-read-it.patch new file mode 100644 index 0000000000..046eb9c9c7 --- /dev/null +++ b/Spigot-Server-Patches/Show-blockstate-location-if-we-failed-to-read-it.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Sat, 15 Jun 2019 10:28:25 -0700 +Subject: [PATCH] Show blockstate location if we failed to read it + + +diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +index 7cb4c3e503..ae60e037a5 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +@@ -0,0 +0,0 @@ public class CraftBlockEntityState extends CraftBlockState + public CraftBlockEntityState(Block block, Class tileEntityClass) { + super(block); + ++ try {// Paper - show location on failure ++ + this.tileEntityClass = tileEntityClass; + + // get tile entity from block: +@@ -0,0 +0,0 @@ public class CraftBlockEntityState extends CraftBlockState + this.load(this.snapshot); + } + // Paper end ++ } catch (Throwable thr) { ++ if (thr instanceof ThreadDeath) { ++ throw (ThreadDeath)thr; ++ } ++ throw new RuntimeException("Failed to read block state at location: (" + block.getX() + ", " + block.getY() + ", " + block.getZ() + ")", thr); ++ } + } + + public final boolean snapshotDisabled; // Paper +-- \ No newline at end of file From 1cda6342bfa6f8d33496e6a41c561911711b9a98 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Sat, 15 Jun 2019 10:36:09 -0700 Subject: [PATCH 2/3] Proper paper commenting --- .../Show-blockstate-location-if-we-failed-to-read-it.patch | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Spigot-Server-Patches/Show-blockstate-location-if-we-failed-to-read-it.patch b/Spigot-Server-Patches/Show-blockstate-location-if-we-failed-to-read-it.patch index 046eb9c9c7..83e68772ed 100644 --- a/Spigot-Server-Patches/Show-blockstate-location-if-we-failed-to-read-it.patch +++ b/Spigot-Server-Patches/Show-blockstate-location-if-we-failed-to-read-it.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Show blockstate location if we failed to read it diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java -index 7cb4c3e503..ae60e037a5 100644 +index 7cb4c3e503..c3405950d8 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java @@ -0,0 +0,0 @@ public class CraftBlockEntityState extends CraftBlockState @@ -21,12 +21,14 @@ index 7cb4c3e503..ae60e037a5 100644 this.load(this.snapshot); } // Paper end ++ // Paper start - show location on failure + } catch (Throwable thr) { + if (thr instanceof ThreadDeath) { + throw (ThreadDeath)thr; + } + throw new RuntimeException("Failed to read block state at location: (" + block.getX() + ", " + block.getY() + ", " + block.getZ() + ")", thr); + } ++ // Paper end } public final boolean snapshotDisabled; // Paper From b1b5cc1713e5371ef2a34c7eb50ec19927e8b76a Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Sat, 15 Jun 2019 11:07:03 -0700 Subject: [PATCH 3/3] fix exception message --- .../Show-blockstate-location-if-we-failed-to-read-it.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Spigot-Server-Patches/Show-blockstate-location-if-we-failed-to-read-it.patch b/Spigot-Server-Patches/Show-blockstate-location-if-we-failed-to-read-it.patch index 83e68772ed..7a6f3e8056 100644 --- a/Spigot-Server-Patches/Show-blockstate-location-if-we-failed-to-read-it.patch +++ b/Spigot-Server-Patches/Show-blockstate-location-if-we-failed-to-read-it.patch @@ -26,7 +26,7 @@ index 7cb4c3e503..c3405950d8 100644 + if (thr instanceof ThreadDeath) { + throw (ThreadDeath)thr; + } -+ throw new RuntimeException("Failed to read block state at location: (" + block.getX() + ", " + block.getY() + ", " + block.getZ() + ")", thr); ++ throw new RuntimeException("Failed to read BlockState at location: (" + block.getX() + ", " + block.getY() + ", " + block.getZ() + ")", thr); + } + // Paper end }