Skip to content

Commit

Permalink
Fix GhostBlockMitigation loading chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
SamB440 committed Jul 17, 2024
1 parent 3b8d0e2 commit bc0b0d5
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,26 @@ public void onBlockPlace(final BlockPlace place) {
int yAgainst = posAgainst.getY();
int zAgainst = posAgainst.getZ();

boolean loaded = false;

try {
for (int i = x - distance; i <= x + distance; i++) {
for (int j = y - distance; j <= y + distance; j++) {
for (int k = z - distance; k <= z + distance; k++) {
if (i == x && j == y && k == z) {
continue;
}

if (i == xAgainst && j == yAgainst && k == zAgainst) {
continue;
}
if (!loaded && world.isChunkLoaded(x >> 4, z >> 4)) {
loaded = true;

if (!world.isChunkLoaded(i >> 4, k >> 4)) {
continue;
}

Block type = world.getBlockAt(i, j, k);
if (type.getType() != Material.AIR) {
return;
}

}
}
}
Expand Down

0 comments on commit bc0b0d5

Please sign in to comment.