mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-22 08:39:14 +00:00
Fixed bad math for MAX_HEIGHT and FAST_MAX_HEIGHT.
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -534,21 +534,21 @@ 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)) {
|
||||
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();
|
||||
@@ -571,19 +571,21 @@ 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)) {
|
||||
y = rdata.getEngine().getHeight() + 1;
|
||||
BlockVector offset = new BlockVector(config.getTranslate().getX(), config.getTranslate().getY(), config.getTranslate().getZ());
|
||||
@@ -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,18 +854,15 @@ 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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user