This commit is contained in:
cyberpwn 2021-08-28 11:55:47 -04:00
parent f06d5b806a
commit 354b02612d
12 changed files with 96 additions and 4 deletions

View File

@ -252,6 +252,11 @@ public class CommandIrisObjectPaste extends MortarCommand {
return false; return false;
} }
@Override
public boolean isCarved(int x, int y, int z) {
return false;
}
@Override @Override
public boolean isSolid(int x, int y, int z) { public boolean isSolid(int x, int y, int z) {
return world.getBlockAt(x, y, z).getType().isSolid(); return world.getBlockAt(x, y, z).getType().isSolid();

View File

@ -133,6 +133,11 @@ public class CommandIrisObjectPasteMatter extends MortarCommand {
return false; return false;
} }
@Override
public boolean isCarved(int x, int y, int z) {
return false;
}
@Override @Override
public boolean isSolid(int x, int y, int z) { public boolean isSolid(int x, int y, int z) {
return world.getBlockAt(x, y, z).getType().isSolid(); return world.getBlockAt(x, y, z).getType().isSolid();

View File

@ -274,6 +274,11 @@ public class DecObject implements DecreeExecutor {
return false; return false;
} }
@Override
public boolean isCarved(int x, int y, int z) {
return false;
}
@Override @Override
public boolean isSolid(int x, int y, int z) { public boolean isSolid(int x, int y, int z) {
return world.getBlockAt(x, y, z).getType().isSolid(); return world.getBlockAt(x, y, z).getType().isSolid();

View File

@ -146,6 +146,11 @@ public class TreeSVC implements IrisService {
return true; return true;
} }
@Override
public boolean isCarved(int x, int y, int z) {
return false;
}
@Override @Override
public boolean isSolid(int x, int y, int z) { public boolean isSolid(int x, int y, int z) {
return get(x, y, z).getMaterial().isSolid(); return get(x, y, z).getMaterial().isSolid();

View File

@ -57,6 +57,11 @@ public class HeightmapObjectPlacer implements IObjectPlacer {
return oplacer.isPreventingDecay(); return oplacer.isPreventingDecay();
} }
@Override
public boolean isCarved(int x, int y, int z) {
return false;
}
public boolean isSolid(int param1Int1, int param1Int2, int param1Int3) { public boolean isSolid(int param1Int1, int param1Int2, int param1Int3) {
return oplacer.isSolid(param1Int1, param1Int2, param1Int3); return oplacer.isSolid(param1Int1, param1Int2, param1Int3);
} }

View File

@ -208,6 +208,11 @@ public class PlannedPiece {
return false; return false;
} }
@Override
public boolean isCarved(int x, int y, int z) {
return false;
}
@Override @Override
public boolean isSolid(int x, int y, int z) { public boolean isSolid(int x, int y, int z) {
return world.getBlockAt(x, y, z).getType().isSolid(); return world.getBlockAt(x, y, z).getType().isSolid();

View File

@ -84,6 +84,11 @@ public interface EngineMantle extends IObjectPlacer {
return getComplex().getTrueHeightStream().get(x, z); return getComplex().getTrueHeightStream().get(x, z);
} }
default boolean isCarved(int x, int h, int z)
{
return getMantle().get(x, h, z, MatterCavern.class) != null;
}
@Override @Override
default void set(int x, int y, int z, BlockData d) { default void set(int x, int y, int z, BlockData d) {
getMantle().set(x, y, z, d == null ? AIR : d); getMantle().set(x, y, z, d == null ? AIR : d);

View File

@ -121,6 +121,11 @@ public class MantleWriter implements IObjectPlacer {
return getEngineMantle().isPreventingDecay(); return getEngineMantle().isPreventingDecay();
} }
@Override
public boolean isCarved(int x, int y, int z) {
return getEngineMantle().isCarved(x, y, z);
}
@Override @Override
public boolean isSolid(int x, int y, int z) { public boolean isSolid(int x, int y, int z) {
return getEngineMantle().isSolid(x, y, z); return getEngineMantle().isSolid(x, y, z);

View File

@ -94,7 +94,6 @@ public class MantleObjectComponent extends IrisMantleComponent {
int zz = rng.i(z, z + 15); int zz = rng.i(z, z + 15);
int id = rng.i(0, Integer.MAX_VALUE); int id = rng.i(0, Integer.MAX_VALUE);
int h = v.place(xx, -1, zz, writer, objectPlacement, rng, int h = v.place(xx, -1, zz, writer, objectPlacement, rng,
(b) -> writer.setData(b.getX(), b.getY(), b.getZ(), (b) -> writer.setData(b.getX(), b.getY(), b.getZ(),
v.getLoadKey() + "@" + id), null, getData()); v.getLoadKey() + "@" + id), null, getData());

View File

@ -104,11 +104,13 @@ public class IrisRavine extends IrisRegistrant {
for(IrisPosition p : pos) for(IrisPosition p : pos)
{ {
int rsurface = y == -1 ? engine.getHeight(p.getX(), p.getZ(), true) : y; int rsurface = y == -1 ? engine.getComplex().getHeightStream().get(x, z).intValue() : y;
int depth = (int) Math.round(dg.fitDouble(depthStyle.getMin(), depthStyle.getMax(), p.getX(), p.getZ())); int depth = (int) Math.round(dg.fitDouble(depthStyle.getMin(), depthStyle.getMax(), p.getX(), p.getZ()));
int width = (int) Math.round(bw.fitDouble(baseWidthStyle.getMin(), baseWidthStyle.getMax(), p.getX(), p.getZ())); int width = (int) Math.round(bw.fitDouble(baseWidthStyle.getMin(), baseWidthStyle.getMax(), p.getX(), p.getZ()));
int surface = (int) Math.round(rsurface - depth * 0.45); int surface = (int) Math.round(rsurface - depth * 0.45);
fork.doCarving(writer, rng, engine, p.getX(), rng.r.i(surface-depth, surface), p.getZ());
for(int i = surface + depth; i >= surface; i--) for(int i = surface + depth; i >= surface; i--)
{ {
if(i % ribThickness == 0) { if(i % ribThickness == 0) {
@ -119,6 +121,11 @@ public class IrisRavine extends IrisRegistrant {
break; break;
} }
if(i <= ribThickness+2)
{
break;
}
writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, CavernMatter.ON); writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, CavernMatter.ON);
} }
} }
@ -133,6 +140,11 @@ public class IrisRavine extends IrisRegistrant {
break; break;
} }
if(i <= ribThickness+2)
{
break;
}
writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, CavernMatter.ON); writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, CavernMatter.ON);
} }
} }

View File

@ -34,6 +34,8 @@ public interface IObjectPlacer {
boolean isPreventingDecay(); boolean isPreventingDecay();
boolean isCarved(int x, int y, int z);
boolean isSolid(int x, int y, int z); boolean isSolid(int x, int y, int z);
boolean isUnderwater(int x, int z); boolean isUnderwater(int x, int z);

View File

@ -459,10 +459,15 @@ public class IrisObject extends IrisRegistrant {
int xx, zz; int xx, zz;
int yrand = config.getTranslate().getYRandom(); int yrand = config.getTranslate().getYRandom();
yrand = yrand > 0 ? rng.i(0, yrand) : yrand < 0 ? rng.i(yrand, 0) : yrand; yrand = yrand > 0 ? rng.i(0, yrand) : yrand < 0 ? rng.i(yrand, 0) : yrand;
boolean bail = false;
if (yv < 0) { if (yv < 0) {
if (config.getMode().equals(ObjectPlaceMode.CENTER_HEIGHT)) { if (config.getMode().equals(ObjectPlaceMode.CENTER_HEIGHT)) {
y = (c != null ? c.getSurface() : placer.getHighest(x, z, getLoader(), config.isUnderwater())) + rty; y = (c != null ? c.getSurface() : placer.getHighest(x, z, getLoader(), config.isUnderwater())) + rty;
if(placer.isCarved(x, y, z) || placer.isCarved(x, y-1, z))
{
bail = true;
}
} else if (config.getMode().equals(ObjectPlaceMode.MAX_HEIGHT) || config.getMode().equals(ObjectPlaceMode.STILT)) { } 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 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(); BlockVector rotatedDimensions = config.getRotation().rotate(new BlockVector(getW(), getH(), getD()), spinx, spiny, spinz).clone();
@ -471,6 +476,12 @@ public class IrisObject extends IrisRegistrant {
for (int j = z - (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j <= z + (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j++) { 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; int h = placer.getHighest(i, j, getLoader(), config.isUnderwater()) + rty;
if(placer.isCarved(i, h, j))
{
bail = true;
break;
}
if (h > y) { if (h > y) {
y = h; y = h;
} }
@ -484,6 +495,12 @@ public class IrisObject extends IrisRegistrant {
for (int j = z - (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j <= z + (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j += (rotatedDimensions.getBlockZ() / 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; int h = placer.getHighest(i, j, getLoader(), config.isUnderwater()) + rty;
if(placer.isCarved(i, h, j))
{
bail = true;
break;
}
if (h > y) { if (h > y) {
y = h; y = h;
} }
@ -497,7 +514,11 @@ public class IrisObject extends IrisRegistrant {
for (int i = x - (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i <= x + (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i++) { 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++) { 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; int h = placer.getHighest(i, j, getLoader(), config.isUnderwater()) + rty;
if(placer.isCarved(i, h, j))
{
bail = true;
break;
}
if (h < y) { if (h < y) {
y = h; y = h;
} }
@ -511,7 +532,11 @@ public class IrisObject extends IrisRegistrant {
for (int i = x - (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i <= x + (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i += (rotatedDimensions.getBlockX() / 2) + 1) { 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) { 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; int h = placer.getHighest(i, j, getLoader(), config.isUnderwater()) + rty;
if(placer.isCarved(i, h, j))
{
bail = true;
break;
}
if (h < y) { if (h < y) {
y = h; y = h;
} }
@ -519,13 +544,27 @@ public class IrisObject extends IrisRegistrant {
} }
} else if (config.getMode().equals(ObjectPlaceMode.PAINT)) { } else if (config.getMode().equals(ObjectPlaceMode.PAINT)) {
y = placer.getHighest(x, z, getLoader(), config.isUnderwater()) + rty; y = placer.getHighest(x, z, getLoader(), config.isUnderwater()) + rty;
if(placer.isCarved(x, y, z))
{
bail = true;
}
} }
} else { } else {
y = yv; y = yv;
if(placer.isCarved(x, y, z))
{
bail = true;
}
} }
if (yv >= 0 && config.isBottom()) { if (yv >= 0 && config.isBottom()) {
y += Math.floorDiv(h, 2); y += Math.floorDiv(h, 2);
bail = placer.isCarved(x, y, z);
}
if(bail)
{
return -1;
} }
if (yv < 0) { if (yv < 0) {