diff --git a/src/main/java/com/volmit/iris/Iris.java b/src/main/java/com/volmit/iris/Iris.java index ca2e00d2b..a8576b4b5 100644 --- a/src/main/java/com/volmit/iris/Iris.java +++ b/src/main/java/com/volmit/iris/Iris.java @@ -244,12 +244,12 @@ public class Iris extends VolmitPlugin implements Listener { return f; } - public static void warn(String string) { - msg(C.YELLOW + string); + public static void warn(String format, Object... objs) { + msg(C.YELLOW + String.format(format, objs)); } - public static void error(String string) { - msg(C.RED + string); + public static void error(String format, Object... objs) { + msg(C.RED + String.format(format, objs)); } public static void debug(String string) { diff --git a/src/main/java/com/volmit/iris/engine/object/IrisObject.java b/src/main/java/com/volmit/iris/engine/object/IrisObject.java index b987ee8cf..e33203bf9 100644 --- a/src/main/java/com/volmit/iris/engine/object/IrisObject.java +++ b/src/main/java/com/volmit/iris/engine/object/IrisObject.java @@ -534,19 +534,19 @@ public class IrisObject extends IrisRegistrant { } else if(config.getMode().equals(ObjectPlaceMode.MAX_HEIGHT) || config.getMode().equals(ObjectPlaceMode.STILT)) { BlockVector offset = new BlockVector(config.getTranslate().getX(), config.getTranslate().getY(), config.getTranslate().getZ()); BlockVector rotatedDimensions = config.getRotation().rotate(new BlockVector(getW(), getH(), getD()), spinx, spiny, spinz).clone(); - - for(int i = x - (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i <= x + (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i++) { - for(int j = z - (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j <= z + (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j++) { - int h = placer.getHighest(i, j, getLoader(), config.isUnderwater()) + rty; - - if(placer.isCarved(i, h, j) || placer.isCarved(i, h - 1, j) || placer.isCarved(i, h - 2, j) || placer.isCarved(i, h - 3, j)) { + int x1 = x - (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); + int x2 = x + (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); + for(int i = Math.min(x1, x2); i <= Math.max(x1, x2); i++) { + int z1 = z - (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); + int z2 = z + (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); + for(int ii = Math.min(z1, z2); ii <= Math.max(z1, z2); ii++) { + int h = placer.getHighest(i, ii, getLoader(), config.isUnderwater()) + rty; + if(placer.isCarved(i, h, ii) || placer.isCarved(i, h - 1, ii) || placer.isCarved(i, h - 2, ii) || placer.isCarved(i, h - 3, ii)) { bail = true; break; } - - if(h > y) { + if(h > y) y = h; - } } } } else if(config.getMode().equals(ObjectPlaceMode.FAST_MAX_HEIGHT) || config.getMode().equals(ObjectPlaceMode.FAST_STILT)) { @@ -571,17 +571,19 @@ public class IrisObject extends IrisRegistrant { y = rdata.getEngine().getHeight() + 1; BlockVector offset = new BlockVector(config.getTranslate().getX(), config.getTranslate().getY(), config.getTranslate().getZ()); BlockVector rotatedDimensions = config.getRotation().rotate(new BlockVector(getW(), getH(), getD()), spinx, spiny, spinz).clone(); - - for(int i = x - (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i <= x + (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i++) { - for(int j = z - (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j <= z + (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j++) { - int h = placer.getHighest(i, j, getLoader(), config.isUnderwater()) + rty; - if(placer.isCarved(i, h, j) || placer.isCarved(i, h - 1, j) || placer.isCarved(i, h - 2, j) || placer.isCarved(i, h - 3, j)) { + int x1 = x - (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); + int x2 = x + (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); + for(int i = Math.min(x1, x2); i <= Math.max(x1, x2); i++) { + int z1 = z - (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); + int z2 = z + (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); + for(int ii = Math.min(z1, z2); ii <= Math.max(z1, z2); ii++) { + int h = placer.getHighest(i, ii, getLoader(), config.isUnderwater()) + rty; + if(placer.isCarved(i, h, ii) || placer.isCarved(i, h - 1, ii) || placer.isCarved(i, h - 2, ii) || placer.isCarved(i, h - 3, ii)) { bail = true; break; } - if(h < y) { + if(h < y) y = h; - } } } } else if(config.getMode().equals(ObjectPlaceMode.FAST_MIN_HEIGHT)) { @@ -745,6 +747,7 @@ public class IrisObject extends IrisRegistrant { data = config.getRotation().rotate(data, spinx, spiny, spinz); xx = x + (int) Math.round(i.getX()); + int yy = y + (int) Math.round(i.getY()); zz = z + (int) Math.round(i.getZ()); @@ -787,7 +790,6 @@ public class IrisObject extends IrisRegistrant { if(!data.getMaterial().equals(Material.AIR) && !data.getMaterial().equals(Material.CAVE_AIR)) { placer.set(xx, yy, zz, data); - if(tile != null) { placer.setTile(xx, yy, zz, tile); } @@ -852,17 +854,14 @@ public class IrisObject extends IrisRegistrant { int yg = placer.getHighest(xx, zz, getLoader(), true); - if(config.isWaterloggable() && yg <= placer.getFluidHeight() && d instanceof Waterlogged) { + if(config.isWaterloggable() && yg <= placer.getFluidHeight() && d instanceof Waterlogged) ((Waterlogged) d).setWaterlogged(true); - } - if(yv >= 0 && config.isBottom()) { + if(yv >= 0 && config.isBottom()) y += Math.floorDiv(h, 2); - } - for(int j = lowest + y; j > yg - config.getOverStilt() - 1; j--) { + for(int j = lowest + y; j > yg - config.getOverStilt() - 1; j--) placer.set(xx, j, zz, d); - } } readLock.unlock();