Drawdown follows zone wetness

- Carry each column's bounded zone wetness and whether climate zones apply to it as wetness and climateZoned sample channels, copied by HeightLattice
- Draw pond and lake surfaces down by climateDrawdown times one minus the bounded zone wetness at the floor inside climate zones, and by one minus rainfall where the zones are off or climateZones is false
- Test the drawdown in wet, dry and transition zones and outside them, and that two windows give a pond the same level
- Test that a policy wetness min keeps a dry-zone pond from drawing down, from the terrain source through the planner
- Describe the rainfall policy as lowering ponds only where the climate zones do not apply
- Recapture the schema digest
This commit is contained in:
Brian Neumann-Fopiano committed 2026-11-02 02:38:59 -05:00
1 parent fa43b276f4
commit 720b9ac967
9 files changed
+210 -20

No files matched your search

@@ -26,7 +26,7 @@ public class IrisHydrologyPolicy {
@MinNumber(0)
@MaxNumber(MAX_MULTIPLIER)
@Description("Multiplier on the water that falls in this area. Higher values grow more and larger streams and keep ponds fuller. With no value set anywhere it is 1.")
@Description("Multiplier on the water that falls in this area. Higher values grow more and larger streams. Where the wet and dry zones do not apply, values below 1 also lower pond and lake surfaces. With no value set anywhere it is 1.")
private Double rainfall = null;
@MinNumber(0)
@@ -166,17 +166,16 @@ public final class IrisHydrologyTerrainSource implements HydrologyTerrainSource,
Policy policy = policy(complex.baseBiomeLineage(x, z), regions.get(x, z));
out.height()[index] = (float) height;
out.ocean()[index] = StrictMath.round(height) < settings.seaLevel() && oceanIntent(x, z);
float wet = policy.climateZones() ? wetness(x, z, policy) : 1f;
boolean zoned = wetness != null && policy.climateZones();
float wet = zoned ? (float) Math.clamp(climate.wetness(wetness.noise(x, z)), policy.minWetness(), policy.maxWetness()) : 1f;
out.rainfall()[index] = policy.rainfall() * wet;
out.pondDensity()[index] = policy.pondDensity() * wet;
out.wetness()[index] = wet;
out.climateZoned()[index] = zoned;
out.permission()[index] = policy.permission();
out.fluidProfile()[index] = policy.fluid();
}
private float wetness(int x, int z, Policy policy) {
return wetness == null ? 1f : (float) Math.clamp(climate.wetness(wetness.noise(x, z)), policy.minWetness(), policy.maxWetness());
}
private boolean oceanIntent(int x, int z) {
BiomeBuffetLayout.Cell cell = buffet == null ? null : buffet.terrain(x, z);
IrisBiome focused = cell == null ? focus : cell.biome();
@@ -184,6 +184,8 @@ public final class HeightLattice {
out.ocean()[index] = samples.ocean()[sample];
out.rainfall()[index] = samples.rainfall()[sample];
out.pondDensity()[index] = samples.pondDensity()[sample];
out.wetness()[index] = samples.wetness()[sample];
out.climateZoned()[index] = samples.climateZoned()[sample];
out.permission()[index] = samples.permission()[sample];
out.fluidProfile()[index] = samples.fluidProfile()[sample];
}
@@ -345,6 +347,8 @@ public final class HeightLattice {
private final boolean[] ocean;
private final float[] rainfall;
private final float[] pondDensity;
private final float[] wetness;
private final boolean[] climateZoned;
private final byte[] permission;
private final String[] fluidProfile;
private final AtomicReferenceArray<CompletableFuture<Void>> marks;
@@ -356,6 +360,8 @@ public final class HeightLattice {
this.ocean = new boolean[cells];
this.rainfall = new float[cells];
this.pondDensity = new float[cells];
this.wetness = new float[cells];
this.climateZoned = new boolean[cells];
this.permission = new byte[cells];
this.fluidProfile = new String[cells];
this.marks = new AtomicReferenceArray<>(cells);
@@ -366,6 +372,8 @@ public final class HeightLattice {
ocean[local] = samples.ocean()[sample];
rainfall[local] = samples.rainfall()[sample];
pondDensity[local] = samples.pondDensity()[sample];
wetness[local] = samples.wetness()[sample];
climateZoned[local] = samples.climateZoned()[sample];
permission[local] = samples.permission()[sample];
fluidProfile[local] = samples.fluidProfile()[sample];
}
@@ -375,6 +383,8 @@ public final class HeightLattice {
out.ocean()[index] = ocean[local];
out.rainfall()[index] = rainfall[local];
out.pondDensity()[index] = pondDensity[local];
out.wetness()[index] = wetness[local];
out.climateZoned()[index] = climateZoned[local];
out.permission()[index] = permission[local];
out.fluidProfile()[index] = fluidProfile[local];
}
@@ -8,6 +8,8 @@ public final class HydrologySampleBuffer {
private final boolean[] ocean;
private final float[] rainfall;
private final float[] pondDensity;
private final float[] wetness;
private final boolean[] climateZoned;
private final byte[] permission;
private final String[] fluidProfile;
@@ -19,6 +21,8 @@ public final class HydrologySampleBuffer {
this.ocean = new boolean[capacity];
this.rainfall = new float[capacity];
this.pondDensity = new float[capacity];
this.wetness = new float[capacity];
this.climateZoned = new boolean[capacity];
this.permission = new byte[capacity];
this.fluidProfile = new String[capacity];
}
@@ -39,6 +43,14 @@ public final class HydrologySampleBuffer {
return pondDensity;
}
public float[] wetness() {
return wetness;
}
public boolean[] climateZoned() {
return climateZoned;
}
public byte[] permission() {
return permission;
}
@@ -228,7 +228,7 @@ public final class PondPlanner {
>= Math.clamp(settings.ponds().natural().keep() * floor.pondDensity()[0], 0f, 1f) * settings.density()) {
return null;
}
return new Candidate(basin, kind, floorX, floorZ, floor.rainfall()[0], fluid(floor));
return new Candidate(basin, kind, floorX, floorZ, dryness(floor), fluid(floor));
}
private Pond lake(LakeCandidate candidate, HeightLattice fine) {
@@ -239,13 +239,18 @@ public final class PondPlanner {
if ((floor.permission()[0] & HydrologySampleBuffer.ALLOW_PONDS) == 0) {
return null;
}
return measureLake(fine, new LakeSite(candidate, floor.rainfall()[0], fluid(floor)));
return measureLake(fine, new LakeSite(candidate, dryness(floor), fluid(floor)));
}
private String fluid(HydrologySampleBuffer floor) {
return floor.fluidProfile()[0] == null ? settings.ponds().fluid() : floor.fluidProfile()[0];
}
private static float dryness(HydrologySampleBuffer floor) {
float wetness = floor.climateZoned()[0] ? floor.wetness()[0] : floor.rainfall()[0];
return Math.clamp(1f - wetness, 0f, 1f);
}
private boolean qualifies(DemGrid raw, Basin basin, PondKind kind) {
long area = (long) basin.cells().length * raw.cell() * raw.cell();
HydrologySettings.NaturalPonds natural = settings.ponds().natural();
@@ -337,7 +342,7 @@ public final class PondPlanner {
return null;
}
int lowest = Math.max(settings.minY() + 1, settings.seaLevel());
int level = Math.min(Math.min(Math.max(lowest, (int) Math.floor(spill.height()) - freeboard(site) - drawdown(site.rainfall())),
int level = Math.min(Math.min(Math.max(lowest, (int) Math.floor(spill.height()) - freeboard(site) - drawdown(site.dryness())),
settings.maxY() - 1), levelCap);
int failures = 0;
for (int round = 0; round < LEVEL_ROUNDS && level >= lowest; round++) {
@@ -763,8 +768,8 @@ public final class PondPlanner {
CellHash.mix(settings.seed(), SALT_FREEBOARD, site.floorX(), site.floorZ()));
}
private int drawdown(float rainfall) {
return Math.round(settings.ponds().climateDrawdown() * Math.clamp(1f - rainfall, 0f, 1f));
private int drawdown(float dryness) {
return Math.round(settings.ponds().climateDrawdown() * dryness);
}
private static int radius(DemGrid raw, Basin basin) {
@@ -800,15 +805,15 @@ public final class PondPlanner {
int floorZ();
float rainfall();
float dryness();
String fluid();
}
private record Candidate(Basin basin, PondKind kind, int floorX, int floorZ, float rainfall, String fluid) implements Site {
private record Candidate(Basin basin, PondKind kind, int floorX, int floorZ, float dryness, String fluid) implements Site {
}
private record LakeSite(LakeCandidate lake, float rainfall, String fluid) implements Site {
private record LakeSite(LakeCandidate lake, float dryness, String fluid) implements Site {
@Override
public PondKind kind() {
return PondKind.LAKE;
@@ -8,14 +8,24 @@ import art.arcane.iris.generation.hydrology.config.IrisFluidProfile;
import art.arcane.iris.generation.hydrology.config.IrisHydrology;
import art.arcane.iris.generation.hydrology.config.IrisHydrologyPolicy;
import art.arcane.iris.generation.hydrology.config.IrisHydrologyWetness;
import art.arcane.iris.generation.hydrology.grid.Basin;
import art.arcane.iris.generation.hydrology.grid.BasinExtractor;
import art.arcane.iris.generation.hydrology.grid.DemGrid;
import art.arcane.iris.generation.hydrology.grid.HeightLattice;
import art.arcane.iris.generation.hydrology.grid.HydrologySampleBuffer;
import art.arcane.iris.generation.hydrology.grid.HydrologyTerrainSource;
import art.arcane.iris.generation.hydrology.grid.PriorityFlood;
import art.arcane.iris.generation.hydrology.plan.HydrologySettings;
import art.arcane.iris.generation.hydrology.plan.WindowKey;
import art.arcane.iris.generation.hydrology.water.CupSet;
import art.arcane.iris.generation.hydrology.water.Pond;
import art.arcane.iris.generation.hydrology.water.PondPlanner;
import art.arcane.iris.generation.stream.ChunkFillableDoubleStream2D;
import art.arcane.iris.generation.terrain.InferredType;
import art.arcane.iris.generation.terrain.IrisMaterialPalette;
import art.arcane.iris.generation.terrain.IrisRegion;
import art.arcane.iris.testsupport.PlatformLeakGuard;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.stream.ProceduralStream;
import org.junit.After;
import org.junit.ClassRule;
@@ -24,6 +34,7 @@ import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import java.nio.file.Path;
import java.util.BitSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -33,6 +44,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -161,15 +173,18 @@ public class IrisHydrologyTerrainSourceTest {
boolean alpha = fixture.complex.getRegionStream().get(x, z).getLoadKey().equals("alpha");
String at = x + "," + z;
assertEquals(at, alpha ? "water" : null, source.channelFluid(x, z));
assertEquals(at, !meadow, samples.climateZoned()[index]);
if (meadow) {
assertEquals(at, 2f, samples.rainfall()[index], 0f);
assertEquals(at, alpha ? 3f : 1f, samples.pondDensity()[index], 0f);
assertEquals(at, 1f, samples.wetness()[index], 0f);
kept++;
continue;
}
boolean zoneDry = samples.rainfall()[index] == 0f;
assertEquals(at, zoneDry ? 0f : 0.5f, samples.rainfall()[index], 0f);
assertEquals(at, zoneDry ? 0f : alpha ? 3f : 1f, samples.pondDensity()[index], 0f);
assertEquals(at, zoneDry ? 0f : 1f, samples.wetness()[index], 0f);
if (zoneDry) {
dry++;
} else {
@@ -214,8 +229,12 @@ public class IrisHydrologyTerrainSourceTest {
float wet = Math.clamp(zoneDry ? 0f : 1f, swamp ? 0.7f : 0f, swamp || alpha ? 1f : 0.35f);
assertEquals(at, rainfall * wet, clamped.rainfall()[index], 0f);
assertEquals(at, ponds * wet, clamped.pondDensity()[index], 0f);
assertEquals(at, wet, clamped.wetness()[index], 0f);
assertTrue(at, clamped.climateZoned()[index]);
assertEquals(at, rainfall, unzoned.rainfall()[index], 0f);
assertEquals(at, ponds, unzoned.pondDensity()[index], 0f);
assertEquals(at, 1f, unzoned.wetness()[index], 0f);
assertFalse(at, unzoned.climateZoned()[index]);
seen.add(leaf + "@" + (alpha ? "alpha" : "beta") + (zoneDry ? " dry" : " wet"));
}
assertTrue("sampled " + seen, seen.containsAll(List.of("meadow@alpha dry", "glade@beta dry", "meadow@beta wet", "spires@beta wet",
@@ -224,6 +243,72 @@ public class IrisHydrologyTerrainSourceTest {
}
}
@Test
public void wetnessMinKeepsADryZonePondFromDrawingDown() throws Exception {
Path pack = childPack("");
int[][] grid = childGrid();
try (EngineFixture.Environment ignored = EngineFixture.environment(); EngineFixture fixture = new EngineFixture(pack)) {
IrisHydrology config = new IrisHydrology().setEnabled(true).setPersist(false);
config.getFluids().add(new IrisFluidProfile().setName("lava").setPalette(new IrisMaterialPalette().qclear().qadd("minecraft:lava")));
config.getClimate().setEnabled(true).setDryness(0.5D).setTransition(0D).setDryRainfall(0.15D).getStyle().setZoom(4D);
config.getPonds().setFreeboard(new KList<>(1, 1));
config.getPonds().getSeeded().setEnabled(false);
HydrologySettings settings = HydrologySettings.compile(config, EngineFixture.SEED, fixture.dimension.getFluidHeight(), 0,
EngineFixture.HEIGHT);
IrisBiome spires = fixture.data.getBiomeLoader().load("spires");
spires.setHydrologyPolicy(new IrisHydrologyPolicy().setPondDensity(16D));
int[] column = dryZoneColumn(fixture, settings, grid, "spires");
Pond dry = floorPond(fixture, settings, column);
spires.setHydrologyPolicy(new IrisHydrologyPolicy().setPondDensity(16D).setWetness(new IrisHydrologyWetness().setMin(0.7D)));
Pond swamp = floorPond(fixture, settings, column);
spires.setHydrologyPolicy(new IrisHydrologyPolicy().setPondDensity(16D).setWetness(new IrisHydrologyWetness().setMin(1D)));
Pond kept = floorPond(fixture, settings, column);
int drawdown = settings.ponds().climateDrawdown();
assertEquals((int) Math.floor(kept.spillHeight()) - 1, kept.level());
assertEquals(kept.level() - Math.round(drawdown * 0.3f), swamp.level());
assertEquals(kept.level() - Math.round(drawdown * 0.85f), dry.level());
}
}
private static int[] dryZoneColumn(EngineFixture fixture, HydrologySettings settings, int[][] grid, String biome) {
HydrologySampleBuffer samples = new HydrologySampleBuffer(grid[0].length);
new IrisHydrologyTerrainSource(fixture.complex, fixture.dimension, settings, null, 1, HydrologyBinding.UNBOUND)
.sample(grid[0], grid[1], samples, false);
for (int index = 0; index < grid[0].length; index++) {
if (samples.rainfall()[index] < 0.1f && fixture.complex.getBaseBiomeStream().get(grid[0][index], grid[1][index]).getLoadKey().equals(biome)) {
return new int[]{grid[0][index], grid[1][index]};
}
}
throw new AssertionError("No sampled " + biome + " column lies in a dry zone");
}
private static Pond floorPond(EngineFixture fixture, HydrologySettings settings, int[] column) {
HydrologySampleBuffer floor = new HydrologySampleBuffer(1);
new IrisHydrologyTerrainSource(fixture.complex, fixture.dimension, settings, null, 1, HydrologyBinding.UNBOUND)
.sample(new int[]{column[0]}, new int[]{column[1]}, floor, false);
FloorBowl bowl = new FloorBowl(settings, floor);
int span = 64;
HydrologySampleBuffer samples = new HydrologySampleBuffer(span * span);
new HeightLattice(bowl, 8, false, 1 << 16).fill(0, 0, span, span, samples);
DemGrid grid = new DemGrid(0, 0, 8, span, span);
System.arraycopy(samples.height(), 0, grid.values(), 0, span * span);
PondPlanner planner = new PondPlanner(settings);
CupSet cups = planner.subtractCups(grid, new WindowKey(0, 0), samples, new BitSet());
BitSet seeds = new BitSet(span * span);
for (int j = 0; j < span; j++) {
for (int i = 0; i < span; i++) {
if (i == 0 || j == 0 || i == span - 1 || j == span - 1) {
seeds.set(grid.index(i, j));
}
}
}
float[] filled = PriorityFlood.fill(grid, seeds, settings.drainage().fillEpsilon());
List<Basin> basins = BasinExtractor.basins(grid, filled, 0.5f, settings.seaLevel());
List<Pond> ponds = planner.ponds(grid, filled, basins, List.of(), new HeightLattice(bowl, 4, false, 1 << 18), cups);
assertEquals("ponds " + ponds, 1, ponds.size());
return ponds.getFirst();
}
@Test
public void policyMultipliersOutsideZeroToSixteenAreRejected() throws Exception {
Path pack = EngineFixture.pack(temporaryFolder.newFolder().toPath());
@@ -525,6 +610,8 @@ public class IrisHydrologyTerrainSourceTest {
assertEquals(at, expected.ocean()[index], actual.ocean()[index]);
assertEquals(at, Float.floatToRawIntBits(expected.rainfall()[index]), Float.floatToRawIntBits(actual.rainfall()[index]));
assertEquals(at, Float.floatToRawIntBits(expected.pondDensity()[index]), Float.floatToRawIntBits(actual.pondDensity()[index]));
assertEquals(at, Float.floatToRawIntBits(expected.wetness()[index]), Float.floatToRawIntBits(actual.wetness()[index]));
assertEquals(at, expected.climateZoned()[index], actual.climateZoned()[index]);
assertEquals(at, expected.permission()[index], actual.permission()[index]);
assertEquals(at, expected.fluidProfile()[index], actual.fluidProfile()[index]);
}
@@ -548,6 +635,46 @@ public class IrisHydrologyTerrainSourceTest {
}
}
private static final class FloorBowl implements HydrologyTerrainSource {
private final HydrologySettings settings;
private final HydrologySampleBuffer floor;
private FloorBowl(HydrologySettings settings, HydrologySampleBuffer floor) {
this.settings = settings;
this.floor = floor;
}
@Override
public void sample(int[] xs, int[] zs, HydrologySampleBuffer out, boolean baseOnly) {
for (int index = 0; index < xs.length; index++) {
double ratio = Math.hypot(xs[index] - 256D, zs[index] - 256D) / 60D;
out.height()[index] = (float) (ratio < 1D ? 200D + 12D * ratio * ratio : 212D - 6D * (ratio - 1D));
out.ocean()[index] = false;
out.rainfall()[index] = floor.rainfall()[0];
out.pondDensity()[index] = floor.pondDensity()[0];
out.wetness()[index] = floor.wetness()[0];
out.climateZoned()[index] = floor.climateZoned()[0];
out.permission()[index] = floor.permission()[0];
out.fluidProfile()[index] = floor.fluidProfile()[0];
}
}
@Override
public int seaLevel() {
return settings.seaLevel();
}
@Override
public int minY() {
return settings.minY();
}
@Override
public int maxY() {
return settings.maxY();
}
}
private static double[] chunk(Map<Long, double[]> chunks, ChunkFillableDoubleStream2D stream, int x, int z) {
long key = ((long) (x >> 4) << 32) | ((z >> 4) & 0xFFFFFFFFL);
return chunks.computeIfAbsent(key, ignored -> {
@@ -365,6 +365,8 @@ public class HeightLatticeTest {
assertEquals(Float.floatToIntBits(expected.height()[index]), Float.floatToIntBits(actual.height()[index]));
assertEquals(Float.floatToIntBits(expected.rainfall()[index]), Float.floatToIntBits(actual.rainfall()[index]));
assertEquals(Float.floatToIntBits(expected.pondDensity()[index]), Float.floatToIntBits(actual.pondDensity()[index]));
assertEquals(Float.floatToIntBits(expected.wetness()[index]), Float.floatToIntBits(actual.wetness()[index]));
assertEquals(expected.climateZoned()[index], actual.climateZoned()[index]);
assertEquals(expected.ocean()[index], actual.ocean()[index]);
assertEquals(expected.permission()[index], actual.permission()[index]);
assertEquals(expected.fluidProfile()[index], actual.fluidProfile()[index]);
@@ -410,6 +412,8 @@ public class HeightLatticeTest {
out.height()[index] = Float.intBitsToFloat(((int) hash & 0x807FFFFF) | 0x42000000);
out.rainfall()[index] = Float.intBitsToFloat(((int) (hash >>> 23) & 0x007FFFFF) | 0x3F000000);
out.pondDensity()[index] = Float.intBitsToFloat(((int) (hash >>> 37) & 0x007FFFFF) | 0x3F800000);
out.wetness()[index] = Float.intBitsToFloat(((int) (hash >>> 11) & 0x007FFFFF) | 0x3F000000);
out.climateZoned()[index] = ((hash >>> 58) & 1L) != 0L;
out.ocean()[index] = ((hash >>> 62) & 1L) != 0L;
out.permission()[index] = (byte) ((hash >>> 60) & (HydrologySampleBuffer.ALLOW_STREAMS | HydrologySampleBuffer.ALLOW_PONDS));
out.fluidProfile()[index] = ((hash >>> 59) & 1L) == 0L ? "water" : "lava";
@@ -414,7 +414,7 @@ public class PondPlannerTest {
}
@Test
public void dryClimateDrawsDownLevel() {
public void lowRainfallDrawsDownPondsOutsideClimateZones() {
HydrologySettings settings = settings(PondPlannerTest::naturalOnly, MIN_Y, MAX_Y);
DoubleBinaryOperator terrain = bowl(256, 256, 60, 100, 12, 0.1);
Pond wet = single(plan(settings, new Terrain(terrain, 1f, ALLOW_ALL, null, MIN_Y, MAX_Y), 0, 0, 64, 64, null, List.of()));
@@ -426,6 +426,31 @@ public class PondPlannerTest {
assertContained(dry, terrain);
}
@Test
public void drawdownFollowsClimateDryness() {
HydrologySettings settings = settings(PondPlannerTest::naturalOnly, MIN_Y, MAX_Y);
DoubleBinaryOperator terrain = bowl(256, 256, 60, 100, 12, 0.1);
int drawdown = settings.ponds().climateDrawdown();
Pond full = single(plan(settings, new Terrain(terrain, 1f, ALLOW_ALL, null, MIN_Y, MAX_Y), 0, 0, 64, 64, null, List.of()));
Pond wetZone = single(plan(settings, new Terrain(terrain, 0.5f, ALLOW_ALL, null, MIN_Y, MAX_Y).climateZoned((x, z) -> 1D),
0, 0, 64, 64, null, List.of()));
Pond dryZone = single(plan(settings, new Terrain(terrain, 1.2f, ALLOW_ALL, null, MIN_Y, MAX_Y).climateZoned((x, z) -> 0.15D),
0, 0, 64, 64, null, List.of()));
DoubleBinaryOperator band = (x, z) -> Math.clamp(0.5D + (x - 256D) / 512D, 0D, 1D);
Terrain transition = new Terrain(terrain, 1f, ALLOW_ALL, null, MIN_Y, MAX_Y).climateZoned(band);
Pond west = single(plan(settings, transition, 0, 0, 64, 64, null, List.of()));
Pond east = single(plan(settings, transition, 128, 64, 64, 64, null, List.of()));
Pond outsideZones = single(plan(settings, new Terrain(terrain, 0.5f, ALLOW_ALL, null, MIN_Y, MAX_Y), 0, 0, 64, 64, null, List.of()));
assertEquals(full.id(), dryZone.id());
assertEquals(full.level(), wetZone.level());
assertEquals(full.level() - Math.round(drawdown * 0.85f), dryZone.level());
assertEquals(full.level() - Math.round(drawdown * 0.5f), west.level());
assertEquals(west.id(), east.id());
assertEquals(west.level(), east.level());
assertEquals(full.level() - Math.round(drawdown * 0.5f), outsideZones.level());
assertContained(dryZone, terrain);
}
@Test
public void pondMaskNeverTouchesHalo() {
HydrologySettings settings = settings(config -> {
@@ -835,13 +860,14 @@ public class PondPlannerTest {
private final int maxY;
private final boolean inland;
private final DoubleBinaryOperator pondDensity;
private final DoubleBinaryOperator wetness;
private Terrain(DoubleBinaryOperator height, float rainfall, byte permission, String fluid, int minY, int maxY) {
this(height, rainfall, permission, fluid, minY, maxY, false, (x, z) -> 1D);
this(height, rainfall, permission, fluid, minY, maxY, false, (x, z) -> 1D, null);
}
private Terrain(DoubleBinaryOperator height, float rainfall, byte permission, String fluid, int minY, int maxY, boolean inland,
DoubleBinaryOperator pondDensity) {
DoubleBinaryOperator pondDensity, DoubleBinaryOperator wetness) {
this.height = height;
this.rainfall = rainfall;
this.permission = permission;
@@ -850,14 +876,19 @@ public class PondPlannerTest {
this.maxY = maxY;
this.inland = inland;
this.pondDensity = pondDensity;
this.wetness = wetness;
}
private Terrain inland() {
return new Terrain(height, rainfall, permission, fluid, minY, maxY, true, pondDensity);
return new Terrain(height, rainfall, permission, fluid, minY, maxY, true, pondDensity, wetness);
}
private Terrain pondDensity(DoubleBinaryOperator density) {
return new Terrain(height, rainfall, permission, fluid, minY, maxY, inland, density);
return new Terrain(height, rainfall, permission, fluid, minY, maxY, inland, density, wetness);
}
private Terrain climateZoned(DoubleBinaryOperator zoneWetness) {
return new Terrain(height, rainfall, permission, fluid, minY, maxY, inland, pondDensity, zoneWetness);
}
@Override
@@ -868,6 +899,8 @@ public class PondPlannerTest {
out.ocean()[index] = !inland && value <= SEA_LEVEL;
out.rainfall()[index] = rainfall;
out.pondDensity()[index] = (float) pondDensity.applyAsDouble(xs[index], zs[index]);
out.wetness()[index] = wetness == null ? 1f : (float) wetness.applyAsDouble(xs[index], zs[index]);
out.climateZoned()[index] = wetness != null;
out.permission()[index] = permission;
out.fluidProfile()[index] = fluid;
}
@@ -84,7 +84,7 @@ public class SchemaBuilderIdentityTest {
@ClassRule
public static final PlatformLeakGuard PLATFORM_GUARD = PlatformLeakGuard.clean();
private static final String EXPECTED_SCHEMA_DIGEST = "6265ecff41869d4148cb6b5ffb6b8f9ddaf2d60d130bd09bba16ffdd4f72f33e";
private static final String EXPECTED_SCHEMA_DIGEST = "34e32452b3e79ed5608e2e71fffeeae85ca99ec5c5c84970eedc9fa7b1c68a04";
private static final List<Class<?>> SCHEMA_ROOTS = List.of(
IrisDimension.class,