diff --git a/src/main/java/com/moulberry/axiom/packet/SetBlockPacketListener.java b/src/main/java/com/moulberry/axiom/packet/SetBlockPacketListener.java index 213f326..37f5c60 100644 --- a/src/main/java/com/moulberry/axiom/packet/SetBlockPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/SetBlockPacketListener.java @@ -46,13 +46,16 @@ public class SetBlockPacketListener implements AxiomPacketListener { int x = getX.invoke(pos); int y = getY.invoke(pos); int z = getZ.invoke(pos); + int cx = x / 16 - (x < 0 ? 1 : 0); + int cy = y / 16 - (y < 0 ? 1 : 0); + int cz = z / 16 - (z < 0 ? 1 : 0); // Update blocks - if(RegionProtection.getProtection.apply(player, world).canBuildInSection(x / 16, y / 16, z / 16)) { + if(RegionProtection.getProtection.apply(player, world).canBuildInSection(cx, cy, cz)) { if (updateNeighbors) { setBlock.invoke(AxiomPaper.convert(player.getWorld()), pos, state, 3); } else { - ChunkSectionModifier section = new ChunkSectionModifier(player.getWorld(), x / 16, y / 16, z / 16); + ChunkSectionModifier section = new ChunkSectionModifier(player.getWorld(), cx, cy, cz); section.setState(x & 0xF, y & 0xF, z & 0xF, state); section.finish(); }