From 246e974dc1d1102bc417630d505492c2fd99fd5c Mon Sep 17 00:00:00 2001 From: Vatuu <21113232+Vatuu@users.noreply.github.com> Date: Fri, 10 Jun 2022 17:43:14 +0200 Subject: [PATCH] Fixed FAST_MIN_HEIGHT being messed up. --- .../volmit/iris/engine/object/IrisObject.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) 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 45af93400..396b8c87d 100644 --- a/src/main/java/com/volmit/iris/engine/object/IrisObject.java +++ b/src/main/java/com/volmit/iris/engine/object/IrisObject.java @@ -548,6 +548,7 @@ public class IrisObject extends IrisRegistrant { } else if(config.getMode().equals(ObjectPlaceMode.FAST_MAX_HEIGHT) || config.getMode().equals(ObjectPlaceMode.FAST_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(); + int xRadius = (rotatedDimensions.getBlockX() / 2); int xLength = xRadius + offset.getBlockX(); int minX = Math.min(x - xLength, x + xLength); @@ -556,6 +557,7 @@ public class IrisObject extends IrisRegistrant { int zLength = zRadius + offset.getBlockZ(); int minZ = Math.min(z - zLength, z + zLength); int maxZ = Math.max(z - zLength, z + zLength); + for(int i = minX; i <= maxX; i += Math.abs(xRadius) + 1) { for(int ii = minZ; ii <= maxZ; ii += Math.abs(zRadius) + 1) { int h = placer.getHighest(i, ii, getLoader(), config.isUnderwater()) + rty; @@ -589,10 +591,19 @@ public class IrisObject extends IrisRegistrant { 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 += (rotatedDimensions.getBlockX() / 2) + 1) { - for(int j = z - (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j <= z + (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j += (rotatedDimensions.getBlockZ() / 2) + 1) { - 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 xRadius = (rotatedDimensions.getBlockX() / 2); + int xLength = xRadius + offset.getBlockX(); + int minX = Math.min(x - xLength, x + xLength); + int maxX = Math.max(x - xLength, x + xLength); + int zRadius = (rotatedDimensions.getBlockZ() / 2); + int zLength = zRadius + offset.getBlockZ(); + int minZ = Math.min(z - zLength, z + zLength); + int maxZ = Math.max(z - zLength, z + zLength); + + for(int i = minX; i <= maxX; i += Math.abs(xRadius) + 1) { + for(int ii = minZ; ii <= maxZ; ii += Math.abs(zRadius) + 1) { + 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; }