From 570b4ebd937cb434af8b4f5890064198bf70dca2 Mon Sep 17 00:00:00 2001 From: sk89q Date: Thu, 27 Mar 2014 20:57:20 -0700 Subject: [PATCH] Made CuboidRegions in EditSession clamp Y to world. --- src/main/java/com/sk89q/worldedit/EditSession.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/EditSession.java b/src/main/java/com/sk89q/worldedit/EditSession.java index 5f3e1f88e..10a089635 100644 --- a/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/src/main/java/com/sk89q/worldedit/EditSession.java @@ -845,6 +845,7 @@ public class EditSession { checkArgument(height >= 1, "height >= 1"); Region region = new CuboidRegion( + getWorld(), // Causes clamping of Y range position.add(-apothem + 1, 0, -apothem + 1), position.add(apothem - 1, height - 1, apothem - 1)); Pattern pattern = new SingleBlockPattern(new BaseBlock(BlockID.AIR)); @@ -866,6 +867,7 @@ public class EditSession { checkArgument(height >= 1, "height >= 1"); Region region = new CuboidRegion( + getWorld(), // Causes clamping of Y range position.add(-apothem + 1, 0, -apothem + 1), position.add(apothem - 1, -height + 1, apothem - 1)); Pattern pattern = new SingleBlockPattern(new BaseBlock(BlockID.AIR)); @@ -887,7 +889,10 @@ public class EditSession { Mask mask = new FuzzyBlockMask(new BaseBlock(blockType, -1)); Vector adjustment = new Vector(1, 1, 1).multiply(apothem - 1); - Region region = new CuboidRegion(position.add(adjustment.multiply(-1)), position.add(adjustment)); + Region region = new CuboidRegion( + getWorld(), // Causes clamping of Y range + position.add(adjustment.multiply(-1)), + position.add(adjustment)); Pattern pattern = new SingleBlockPattern(new BaseBlock(BlockID.AIR)); return replaceBlocks(region, mask, pattern); } @@ -2175,7 +2180,10 @@ public class EditSession { generator.setPlant(GardenPatchGenerator.getPumpkinPattern()); // In a region of the given radius - Region region = new CuboidRegion(position.add(-apothem, -5, -apothem), position.add(apothem, 10, apothem)); + Region region = new CuboidRegion( + getWorld(), // Causes clamping of Y range + position.add(-apothem, -5, -apothem), + position.add(apothem, 10, apothem)); // And we want to scatter them GroundScatterFunction scatter = new GroundScatterFunction(this, generator);