Skip to content

Commit

Permalink
Fix BlockEntity test. Fix #304
Browse files Browse the repository at this point in the history
  • Loading branch information
tr7zw committed Nov 2, 2024
1 parent 4a32343 commit f1317bc
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down

0 comments on commit f1317bc

Please sign in to comment.