Skip to content

Commit

Permalink
Prevent chunk loading during tile entity tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SoSeDiK committed Jul 1, 2024
1 parent 5280ba8 commit b565902
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit b565902

Please sign in to comment.