mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-09 18:08:27 +01:00
Limit blueprint pasting to world y coords. Addresses #2334
This commit is contained in:
parent
ea8562f351
commit
1bce4ec1b9
@ -119,6 +119,9 @@ public class BlueprintPaster {
|
|||||||
Vector off = bp.getBedrock() != null ? bp.getBedrock() : new Vector(0,0,0);
|
Vector off = bp.getBedrock() != null ? bp.getBedrock() : new Vector(0,0,0);
|
||||||
// Calculate location for pasting
|
// Calculate location for pasting
|
||||||
this.location = island.getProtectionCenter().toVector().subtract(off).toLocation(world);
|
this.location = island.getProtectionCenter().toVector().subtract(off).toLocation(world);
|
||||||
|
// Ensure the y coordinate is within the world limits
|
||||||
|
int y = Math.min(world.getMaxHeight() - 1, Math.max(world.getMinHeight(), location.getBlockY()));
|
||||||
|
location.setY(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private record Bits(Map<Vector, BlueprintBlock> blocks,
|
private record Bits(Map<Vector, BlueprintBlock> blocks,
|
||||||
|
Loading…
Reference in New Issue
Block a user