From e87a5559d68c8ba75712a99e304755af8203ae2d Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Wed, 10 Jul 2019 14:10:22 -0700 Subject: [PATCH] Ensure blocks are not moved below world boundary --- .../com/sk89q/worldedit/command/tool/brush/GravityBrush.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java index edd58c68b..08288636e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java @@ -42,6 +42,7 @@ public class GravityBrush implements Brush { @Override public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException { double yMax = fullHeight ? editSession.getWorld().getMaxY() : position.getY() + size; + double yMin = Math.max(position.getY() - size, 0); LocatedBlockList column = new LocatedBlockList(); Set removedBlocks = new LinkedHashSet<>(); for (double x = position.getX() - size; x <= position.getX() + size; x++) { @@ -55,7 +56,7 @@ public class GravityBrush implements Brush { */ BlockVector3 lowestAir = null; - for (double y = position.getY() - size; y <= yMax; y++) { + for (double y = yMin; y <= yMax; y++) { BlockVector3 pt = BlockVector3.at(x, y, z); BaseBlock block = editSession.getFullBlock(pt);