Fix regen

This commit is contained in:
Jesse Boyd 2016-05-02 13:14:13 +10:00
parent bf0903246b
commit d7f121f8a9
2 changed files with 11 additions and 3 deletions

View File

@ -1,6 +1,7 @@
package com.boydti.fawe.object.brush; package com.boydti.fawe.object.brush;
import com.boydti.fawe.config.BBC; 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.ArrayHeightMap;
import com.boydti.fawe.object.brush.heightmap.HeightMap; import com.boydti.fawe.object.brush.heightmap.HeightMap;
import com.boydti.fawe.object.exception.FaweException; import com.boydti.fawe.object.exception.FaweException;
@ -18,6 +19,7 @@ import java.awt.image.BufferedImage;
import java.awt.image.Raster; import java.awt.image.Raster;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.HashSet;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
public class HeightBrush implements Brush { public class HeightBrush implements Brush {
@ -41,7 +43,13 @@ public class HeightBrush implements Brush {
int minY = clipboard.getMinimumPoint().getBlockY(); int minY = clipboard.getMinimumPoint().getBlockY();
int maxY = clipboard.getMaximumPoint().getBlockY(); int maxY = clipboard.getMaximumPoint().getBlockY();
int clipHeight = maxY - minY + 1; int clipHeight = maxY - minY + 1;
HashSet<IntegerPair> visited = new HashSet<>();
for (Vector pos : clipboard.getRegion()) { 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 xx = pos.getBlockX();
int zz = pos.getBlockZ(); int zz = pos.getBlockZ();
int highestY = 0; int highestY = 0;

View File

@ -243,11 +243,11 @@ public class WorldWrapper extends AbstractWorld {
int bz = cz << 4; int bz = cz << 4;
Vector cmin = new Vector(bx, 0, bz); Vector cmin = new Vector(bx, 0, bz);
Vector cmax = cmin.add(15, getMaxY(), 15); 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 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); boolean containsTop2 = region.contains(cmax);
if (fe == null || (containsBot2 && containsTop2 && !containsBot1 && !containsTop1)) { if ((containsBot2 && containsTop2 && !containsBot1 && !containsTop1)) {
return; return;
} }
if (cuboid && containsBot1 && containsBot2 && containsTop1 && containsTop2) { if (cuboid && containsBot1 && containsBot2 && containsTop1 && containsTop2) {