Paper/patches/server/0337-Show-blockstate-location-if-we-failed-to-read-it.patch

34 lines
1.5 KiB
Diff
Raw Normal View History

2021-06-11 20:02:28 +08:00
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
index aaddbaecc25af87c863fe51098eb322fd5702104..d2ff7e373476aaab0d4d08977c9d9f274fff67bf 100644
2021-06-11 20:02:28 +08:00
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
@@ -18,6 +18,7 @@ public abstract class CraftBlockEntityState<T extends BlockEntity> extends Craft
2021-06-11 20:02:28 +08:00
this.tileEntity = tileEntity;
2021-06-11 20:02:28 +08:00
+ try { // Paper - show location on failure
// Paper start
this.snapshotDisabled = DISABLE_SNAPSHOT;
if (DISABLE_SNAPSHOT) {
@@ -30,6 +31,14 @@ public abstract class CraftBlockEntityState<T extends BlockEntity> extends Craft
2021-06-11 20:02:28 +08:00
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 BlockState at: world: " + this.getWorld().getName() + " location: (" + this.getX() + ", " + this.getY() + ", " + this.getZ() + ")", thr);
2021-06-11 20:02:28 +08:00
+ }
+ // Paper end
}
public void refreshSnapshot() {