Paper/Spigot-Server-Patches/0359-Show-blockstate-location-if-we-failed-to-read-it.patch

35 lines
1.6 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
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
2021-05-16 01:42:36 +02:00
index 2f0b48869077c27d0cacea81a99c9e34ff59c684..a4bd0d352c2babdbb31cdf49d63e2db3af4de146 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
@@ -19,6 +19,8 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
public CraftBlockEntityState(Block block, Class<T> tileEntityClass) {
super(block);
+ try {// Paper - show location on failure
+
this.tileEntityClass = tileEntityClass;
// get tile entity from block:
@@ -38,6 +40,14 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
this.load(this.snapshot);
}
// Paper end
2019-06-15 19:36:09 +02:00
+ // Paper start - show location on failure
+ } catch (Throwable thr) {
+ if (thr instanceof ThreadDeath) {
+ throw (ThreadDeath)thr;
+ }
2019-06-18 02:43:18 +02:00
+ throw new RuntimeException("Failed to read BlockState at: world: " + block.getWorld().getName() + " location: (" + block.getX() + ", " + block.getY() + ", " + block.getZ() + ")", thr);
+ }
2019-06-15 19:36:09 +02:00
+ // Paper end
}
public final boolean snapshotDisabled; // Paper