From 61a6d011d9807d0107f6e023c028cc648b1a85c8 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 | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Spigot-Server-Patches/0403-Show-blockstate-location-if-we-failed-to-read-it.patch diff --git a/Spigot-Server-Patches/0403-Show-blockstate-location-if-we-failed-to-read-it.patch b/Spigot-Server-Patches/0403-Show-blockstate-location-if-we-failed-to-read-it.patch new file mode 100644 index 0000000000..4e6c0af44c --- /dev/null +++ b/Spigot-Server-Patches/0403-Show-blockstate-location-if-we-failed-to-read-it.patch @@ -0,0 +1,35 @@ +From ad642b8a96422599dca0f13e71a00938419c6c86 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 +@@ -20,6 +20,8 @@ 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: +@@ -39,6 +41,12 @@ 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 +-- +2.21.0 + From 9a5ec7f21d903e2794b2abb3a7116da2875081b6 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 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Spigot-Server-Patches/0403-Show-blockstate-location-if-we-failed-to-read-it.patch b/Spigot-Server-Patches/0403-Show-blockstate-location-if-we-failed-to-read-it.patch index 4e6c0af44c..e86ea20d05 100644 --- a/Spigot-Server-Patches/0403-Show-blockstate-location-if-we-failed-to-read-it.patch +++ b/Spigot-Server-Patches/0403-Show-blockstate-location-if-we-failed-to-read-it.patch @@ -1,11 +1,11 @@ -From ad642b8a96422599dca0f13e71a00938419c6c86 Mon Sep 17 00:00:00 2001 +From dd703d1aa219e991a2d305e780ed3fba30c12049 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 +index 7cb4c3e503..c3405950d8 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java @@ -20,6 +20,8 @@ public class CraftBlockEntityState extends CraftBlockState @@ -17,16 +17,18 @@ index 7cb4c3e503..ae60e037a5 100644 this.tileEntityClass = tileEntityClass; // get tile entity from block: -@@ -39,6 +41,12 @@ public class CraftBlockEntityState extends CraftBlockState +@@ -39,6 +41,14 @@ public class CraftBlockEntityState extends CraftBlockState 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 fcb4d9ab2801a7e05f9d305e879c6455e9569c9a 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 --- .../0403-Show-blockstate-location-if-we-failed-to-read-it.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Spigot-Server-Patches/0403-Show-blockstate-location-if-we-failed-to-read-it.patch b/Spigot-Server-Patches/0403-Show-blockstate-location-if-we-failed-to-read-it.patch index e86ea20d05..de7f5e86d1 100644 --- a/Spigot-Server-Patches/0403-Show-blockstate-location-if-we-failed-to-read-it.patch +++ b/Spigot-Server-Patches/0403-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 }