From b565902006dff94b9012c8cef1b0efb0c2a88ede Mon Sep 17 00:00:00 2001 From: SoSeDiK Date: Mon, 1 Jul 2024 15:20:52 +0300 Subject: [PATCH] Prevent chunk loading during tile entity tests --- .../main/java/de/tr7zw/nbtapi/plugin/tests/tiles/TileTest.java | 2 +- .../nbtapi/plugin/tests/tiles/TilesCustomNBTPersistentTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/item-nbt-plugin/src/main/java/de/tr7zw/nbtapi/plugin/tests/tiles/TileTest.java b/item-nbt-plugin/src/main/java/de/tr7zw/nbtapi/plugin/tests/tiles/TileTest.java index 19333d70d..021503c31 100644 --- a/item-nbt-plugin/src/main/java/de/tr7zw/nbtapi/plugin/tests/tiles/TileTest.java +++ b/item-nbt-plugin/src/main/java/de/tr7zw/nbtapi/plugin/tests/tiles/TileTest.java @@ -22,7 +22,7 @@ public void test() throws Exception { try { Block block = world.getBlockAt(world.getSpawnLocation().getBlockX(), 254, world.getSpawnLocation().getBlockZ()); - if (block.getChunk().isLoaded() && block.getType() == Material.AIR) { + if (world.isChunkLoaded(block.getX() >> 4, block.getZ() >> 4) && block.getType() == Material.AIR) { block.setType(Material.CHEST); NBTTileEntity tile = new NBTTileEntity(block.getState()); if (!MinecraftVersion.isNewerThan(MinecraftVersion.MC1_17_R1)) { diff --git a/item-nbt-plugin/src/main/java/de/tr7zw/nbtapi/plugin/tests/tiles/TilesCustomNBTPersistentTest.java b/item-nbt-plugin/src/main/java/de/tr7zw/nbtapi/plugin/tests/tiles/TilesCustomNBTPersistentTest.java index 6002a5d57..ff821a90b 100644 --- a/item-nbt-plugin/src/main/java/de/tr7zw/nbtapi/plugin/tests/tiles/TilesCustomNBTPersistentTest.java +++ b/item-nbt-plugin/src/main/java/de/tr7zw/nbtapi/plugin/tests/tiles/TilesCustomNBTPersistentTest.java @@ -25,7 +25,7 @@ public void test() throws Exception { try { Block block = world.getBlockAt(world.getSpawnLocation().getBlockX(), 250, world.getSpawnLocation().getBlockZ()); - if (block.getType() == Material.AIR) { + if (world.isChunkLoaded(block.getX() >> 4, block.getZ() >> 4) && block.getType() == Material.AIR) { block.setType(Material.CHEST); NBTTileEntity comp = new NBTTileEntity(block.getState()); NBTCompound persistentData = comp.getPersistentDataContainer();