From d7f121f8a99c530671df2d108a9337043aa11adb Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 2 May 2016 13:14:13 +1000 Subject: [PATCH] Fix regen --- .../java/com/boydti/fawe/object/brush/HeightBrush.java | 8 ++++++++ .../main/java/com/boydti/fawe/wrappers/WorldWrapper.java | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/boydti/fawe/object/brush/HeightBrush.java b/core/src/main/java/com/boydti/fawe/object/brush/HeightBrush.java index 3ef8710e..a4cfe2f1 100644 --- a/core/src/main/java/com/boydti/fawe/object/brush/HeightBrush.java +++ b/core/src/main/java/com/boydti/fawe/object/brush/HeightBrush.java @@ -1,6 +1,7 @@ package com.boydti.fawe.object.brush; import com.boydti.fawe.config.BBC; +import com.boydti.fawe.object.IntegerPair; import com.boydti.fawe.object.brush.heightmap.ArrayHeightMap; import com.boydti.fawe.object.brush.heightmap.HeightMap; import com.boydti.fawe.object.exception.FaweException; @@ -18,6 +19,7 @@ import java.awt.image.BufferedImage; import java.awt.image.Raster; import java.io.File; import java.io.IOException; +import java.util.HashSet; import javax.imageio.ImageIO; public class HeightBrush implements Brush { @@ -41,7 +43,13 @@ public class HeightBrush implements Brush { int minY = clipboard.getMinimumPoint().getBlockY(); int maxY = clipboard.getMaximumPoint().getBlockY(); int clipHeight = maxY - minY + 1; + HashSet visited = new HashSet<>(); for (Vector pos : clipboard.getRegion()) { + IntegerPair pair = new IntegerPair((int) pos.x, (int) pos.z); + if (visited.contains(pair)) { + continue; + } + visited.add(pair); int xx = pos.getBlockX(); int zz = pos.getBlockZ(); int highestY = 0; diff --git a/core/src/main/java/com/boydti/fawe/wrappers/WorldWrapper.java b/core/src/main/java/com/boydti/fawe/wrappers/WorldWrapper.java index 9260f850..8cfaeb50 100644 --- a/core/src/main/java/com/boydti/fawe/wrappers/WorldWrapper.java +++ b/core/src/main/java/com/boydti/fawe/wrappers/WorldWrapper.java @@ -243,11 +243,11 @@ public class WorldWrapper extends AbstractWorld { int bz = cz << 4; Vector cmin = new Vector(bx, 0, bz); Vector cmax = cmin.add(15, getMaxY(), 15); - boolean containsBot1 = (fe != null && fe.contains(cmin.getBlockX(), cmin.getBlockY(), cmin.getBlockZ())); + boolean containsBot1 = (fe == null || fe.contains(cmin.getBlockX(), cmin.getBlockY(), cmin.getBlockZ())); boolean containsBot2 = region.contains(cmin); - boolean containsTop1 = (fe != null && fe.contains(cmax.getBlockX(), cmax.getBlockY(), cmax.getBlockZ())); + boolean containsTop1 = (fe == null || fe.contains(cmax.getBlockX(), cmax.getBlockY(), cmax.getBlockZ())); boolean containsTop2 = region.contains(cmax); - if (fe == null || (containsBot2 && containsTop2 && !containsBot1 && !containsTop1)) { + if ((containsBot2 && containsTop2 && !containsBot1 && !containsTop1)) { return; } if (cuboid && containsBot1 && containsBot2 && containsTop1 && containsTop2) {