From bfb28b471024680418f5e05c5678b39c649f3919 Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Sun, 11 Aug 2024 12:03:48 +0100 Subject: [PATCH] Log current block entity in TickScheduler This check should be impossible (the BE has not been removed, but is no longer present in the world), but we've had one instance where it has happened (#1925). I don't have a good solution here, so at least let's print both BEs for now. --- .../java/dan200/computercraft/shared/util/TickScheduler.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/common/src/main/java/dan200/computercraft/shared/util/TickScheduler.java b/projects/common/src/main/java/dan200/computercraft/shared/util/TickScheduler.java index f54baf78e..1ae910185 100644 --- a/projects/common/src/main/java/dan200/computercraft/shared/util/TickScheduler.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/util/TickScheduler.java @@ -109,8 +109,9 @@ public final class TickScheduler { return State.UNLOADED; } else { // This should be impossible: either the block entity is at the above position, or it has been removed. - if (level.getBlockEntity(pos) != blockEntity) { - throw new IllegalStateException("Expected " + blockEntity + " at " + pos); + var currentBlockEntity = level.getBlockEntity(pos); + if (currentBlockEntity != blockEntity) { + throw new IllegalStateException("Expected " + blockEntity + " at " + pos + ", got " + currentBlockEntity); } // Otherwise schedule a tick and remove it from the queue.