From f1317bcb04884a06434a94289bf5cf6dd79a7d79 Mon Sep 17 00:00:00 2001 From: tr7zw Date: Sat, 2 Nov 2024 13:06:19 +0100 Subject: [PATCH] Fix BlockEntity test. Fix #304 --- .../de/tr7zw/nbtapi/plugin/tests/tiles/TileTest.java | 9 +++++++++ 1 file changed, 9 insertions(+) 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 021503c31..01e64a6f7 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 @@ -5,6 +5,7 @@ import org.bukkit.World; import org.bukkit.block.Block; +import de.tr7zw.changeme.nbtapi.NBT; import de.tr7zw.changeme.nbtapi.NBTTileEntity; import de.tr7zw.changeme.nbtapi.NbtApiException; import de.tr7zw.changeme.nbtapi.utils.MinecraftVersion; @@ -24,6 +25,14 @@ public void test() throws Exception { world.getSpawnLocation().getBlockZ()); if (world.isChunkLoaded(block.getX() >> 4, block.getZ() >> 4) && block.getType() == Material.AIR) { block.setType(Material.CHEST); + if (MinecraftVersion.isNewerThan(MinecraftVersion.MC1_21_R1)) { + // 1.21 changed the lock logic. So just try to get/set data, dont check for now + NBT.modify(block.getState(), nbt -> { + nbt.setString("foo", "bar"); + }); + block.setType(Material.AIR); + return; + } NBTTileEntity tile = new NBTTileEntity(block.getState()); if (!MinecraftVersion.isNewerThan(MinecraftVersion.MC1_17_R1)) { if (tile.getInteger("y") != 254) {