Skip to content

Commit 1f1facb

Browse files
committed
use block coords to check if chunk is loaded
1 parent e05eefc commit 1f1facb

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

realty-paper-api/src/main/java/io/github/md5sha256/realty/api/SignTextApplicator.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,12 @@ public ApplyResult applySignTextIfLoaded(@NotNull World world,
106106
@NotNull String regionId,
107107
@NotNull RegionState state,
108108
@NotNull java.util.Map<String, String> placeholders) {
109-
Block block = world.getBlockAt(blockX, blockY, blockZ);
110-
if (!block.getChunk().isLoaded()) {
109+
int chunkX = blockX >> 4;
110+
int chunkZ = blockZ >> 4;
111+
if (!world.isChunkLoaded(chunkX, chunkZ)) {
111112
return ApplyResult.BLOCK_NOT_LOADED;
112113
}
114+
Block block = world.getBlockAt(blockX, blockY, blockZ);
113115
if (!(block.getState(false) instanceof Sign sign)) {
114116
return ApplyResult.FAILED;
115117
}

0 commit comments

Comments
 (0)