Fix AnvilMenu worldpos NPE (#1311)

This commit is contained in:
IzzelAliz 2024-04-12 06:44:16 +00:00
parent 10da078de0
commit 52ab6e5e52

View File

@ -18,11 +18,12 @@ public interface IWorldPosCallableBridge {
} }
default Location bridge$getLocation() { default Location bridge$getLocation() {
CraftWorld world = ((WorldBridge) bridge$getWorld()).bridge$getWorld();
BlockPos blockPos = bridge$getPosition(); BlockPos blockPos = bridge$getPosition();
if (blockPos == null) { if (blockPos == null) {
return null; return null;
} else { } else {
Level level = bridge$getWorld();
CraftWorld world = level == null ? null : ((WorldBridge) level).bridge$getWorld();
return new Location(world, blockPos.getX(), blockPos.getY(), blockPos.getZ()); return new Location(world, blockPos.getX(), blockPos.getY(), blockPos.getZ());
} }
} }