Skip to content

Commit

Permalink
Limit blueprint pasting to world y coords. Addresses #2334
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Mar 29, 2024
1 parent ea8562f commit 1bce4ec
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ public BlueprintPaster(@NonNull BentoBox plugin, @NonNull Blueprint bp, World wo
Vector off = bp.getBedrock() != null ? bp.getBedrock() : new Vector(0,0,0);
// Calculate location for pasting
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,
Expand Down

0 comments on commit 1bce4ec

Please sign in to comment.