Piston should not be included in moved block bounding box (#1088)
This commit is contained in:
parent
e1086c3206
commit
8c7abf9fd5
|
|
@ -514,11 +514,6 @@ public class BlockEventHandler implements Listener
|
||||||
if (!GriefPrevention.instance.claimsEnabledForWorld(event.getBlock().getWorld())) return;
|
if (!GriefPrevention.instance.claimsEnabledForWorld(event.getBlock().getWorld())) return;
|
||||||
|
|
||||||
BlockFace direction = event.getDirection();
|
BlockFace direction = event.getDirection();
|
||||||
|
|
||||||
// Direction is always piston facing, correct for retraction.
|
|
||||||
if (isRetract)
|
|
||||||
direction = direction.getOppositeFace();
|
|
||||||
|
|
||||||
Block pistonBlock = event.getBlock();
|
Block pistonBlock = event.getBlock();
|
||||||
Claim pistonClaim = this.dataStore.getClaimAt(pistonBlock.getLocation(), false, null);
|
Claim pistonClaim = this.dataStore.getClaimAt(pistonBlock.getLocation(), false, null);
|
||||||
|
|
||||||
|
|
@ -545,20 +540,23 @@ public class BlockEventHandler implements Listener
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize bounding box for moved blocks with first in list.
|
||||||
int minX, maxX, minY, maxY, minZ, maxZ;
|
int minX, maxX, minY, maxY, minZ, maxZ;
|
||||||
minX = maxX = pistonBlock.getX();
|
Block movedBlock = blocks.get(0);
|
||||||
minY = maxY = pistonBlock.getY();
|
minX = maxX = movedBlock.getX();
|
||||||
minZ = maxZ = pistonBlock.getZ();
|
minY = maxY = movedBlock.getY();
|
||||||
|
minZ = maxZ = movedBlock.getZ();
|
||||||
|
|
||||||
// Find min and max values for faster claim lookups and bounding box-based fast mode.
|
// Fill in rest of bounding box with remaining blocks.
|
||||||
for (Block block : blocks)
|
for (int count = 1; count < blocks.size(); ++count)
|
||||||
{
|
{
|
||||||
minX = Math.min(minX, block.getX());
|
movedBlock = blocks.get(count);
|
||||||
minY = Math.min(minY, block.getY());
|
minX = Math.min(minX, movedBlock.getX());
|
||||||
minZ = Math.min(minZ, block.getZ());
|
minY = Math.min(minY, movedBlock.getY());
|
||||||
maxX = Math.max(maxX, block.getX());
|
minZ = Math.min(minZ, movedBlock.getZ());
|
||||||
maxY = Math.max(maxY, block.getY());
|
maxX = Math.max(maxX, movedBlock.getX());
|
||||||
maxZ = Math.max(maxZ, block.getZ());
|
maxY = Math.max(maxY, movedBlock.getY());
|
||||||
|
maxZ = Math.max(maxZ, movedBlock.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add direction to include invaded zone.
|
// Add direction to include invaded zone.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user