Fix slope palette interaction with Elevation

This commit is contained in:
dfsek 2020-11-11 02:54:40 -07:00
parent 171581c224
commit dd33998cf8
3 changed files with 7 additions and 15 deletions

View File

@ -41,7 +41,6 @@ public class BiomeConfig extends TerraConfig {
private final Palette<BlockData> slant; private final Palette<BlockData> slant;
private final double ySlantOffsetTop; private final double ySlantOffsetTop;
private final double ySlantOffsetBottom; private final double ySlantOffsetBottom;
private final double xzSlantOffset;
private String eq; private String eq;
@ -136,7 +135,6 @@ public class BiomeConfig extends TerraConfig {
} else slant = null; } else slant = null;
ySlantOffsetTop = getDouble("slant.y-offset.top", 0.25); ySlantOffsetTop = getDouble("slant.y-offset.top", 0.25);
ySlantOffsetBottom = getDouble("slant.y-offset.bottom", 0.25); ySlantOffsetBottom = getDouble("slant.y-offset.bottom", 0.25);
xzSlantOffset = getDouble("slant.x-z-offset", 1);
//Make sure equation is non-null //Make sure equation is non-null
if(eq == null || eq.equals("")) if(eq == null || eq.equals(""))
@ -208,10 +206,6 @@ public class BiomeConfig extends TerraConfig {
return ySlantOffsetBottom; return ySlantOffsetBottom;
} }
public double getXZSlantOffset() {
return xzSlantOffset;
}
@Override @Override
public String toString() { public String toString() {
return "Biome with ID " + getID() + " and noise equation " + eq; return "Biome with ID " + getID() + " and noise equation " + eq;

View File

@ -83,16 +83,15 @@ public class TerraChunkGenerator extends GaeaChunkGenerator {
private static Palette<BlockData> getPalette(int x, int y, int z, BiomeConfig c, ChunkInterpolator interpolator, ElevationInterpolator elevationInterpolator) { private static Palette<BlockData> getPalette(int x, int y, int z, BiomeConfig c, ChunkInterpolator interpolator, ElevationInterpolator elevationInterpolator) {
Palette<BlockData> slant = c.getSlant(); Palette<BlockData> slant = c.getSlant();
if(slant != null) { if(slant != null) {
double xzOffset = c.getXZSlantOffset(); boolean north = interpolator.getNoise(x, y - elevationInterpolator.getElevation(x, z + 1), z + 1) > 0;
boolean north = interpolator.getNoise(x, y + elevationInterpolator.getElevation(x, (int) (z + xzOffset)), z + xzOffset) > 0; boolean south = interpolator.getNoise(x, y - elevationInterpolator.getElevation(x, z - 1), z - 1) > 0;
boolean south = interpolator.getNoise(x, y + elevationInterpolator.getElevation(x, (int) (z - xzOffset)), z - xzOffset) > 0; boolean east = interpolator.getNoise(x + 1, y - elevationInterpolator.getElevation(x + 1, z), z) > 0;
boolean east = interpolator.getNoise(x + xzOffset, y + elevationInterpolator.getElevation((int) (x + xzOffset), z), z) > 0; boolean west = interpolator.getNoise(x - 1, y - elevationInterpolator.getElevation(x - 1, z), z) > 0;
boolean west = interpolator.getNoise(x - xzOffset, y + elevationInterpolator.getElevation((int) (x - xzOffset), z), z) > 0;
double ySlantOffsetTop = c.getYSlantOffsetTop(); double ySlantOffsetTop = c.getYSlantOffsetTop();
double ySlantOffsetBottom = c.getYSlantOffsetBottom(); double ySlantOffsetBottom = c.getYSlantOffsetBottom();
boolean top = interpolator.getNoise(x, y + ySlantOffsetTop + elevationInterpolator.getElevation(x, z), z) > 0; boolean top = interpolator.getNoise(x, y + ySlantOffsetTop - elevationInterpolator.getElevation(x, z), z) > 0;
boolean bottom = interpolator.getNoise(x, y - ySlantOffsetBottom + elevationInterpolator.getElevation(x, z), z) > 0; boolean bottom = interpolator.getNoise(x, y - ySlantOffsetBottom - elevationInterpolator.getElevation(x, z), z) > 0;
if((top && bottom) && (north || south || east || west) && (!(north && south && east && west))) return slant; if((top && bottom) && (north || south || east || west) && (!(north && south && east && west))) return slant;
} }

View File

@ -18,9 +18,8 @@ prevent-smooth: true
slant: slant:
palette: STONE palette: STONE
y-offset: y-offset:
top: 1 top: 0.25
bottom: 0.25 bottom: 0.25
x-z-offset: 1
flora: flora:
chance: 40 chance: 40