mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-12-01 02:04:51 +00:00
Tidal reach plan format
- Add ReachStyle.TIDAL with code 6, rastered as WaterRole.INLET with sea fluid - Add a tidal tier to the settings, built from the river tier and the inlet bank knobs - Remove the inlet section from WindowPlan, HydrologyPlanCodec and HydrologyPlanPreview - Require tidal reaches to be whole, at sea level and draining to the sea - Record, search and draw inlets from tidal reaches
This commit is contained in:
35 files changed
+253
-494
No files matched your search
+13
-14
@@ -11,7 +11,6 @@ import art.arcane.iris.generation.hydrology.query.HydrologyFeatureQuery;
|
||||
import art.arcane.iris.generation.hydrology.query.HydrologyFeatureRef;
|
||||
import art.arcane.iris.generation.hydrology.query.HydrologyFeatureType;
|
||||
import art.arcane.iris.generation.hydrology.query.HydrologySearchTimeoutException;
|
||||
import art.arcane.iris.generation.hydrology.underground.SeaInlet;
|
||||
import art.arcane.iris.generation.hydrology.water.HydrologyTier;
|
||||
import art.arcane.iris.generation.hydrology.water.Pond;
|
||||
import art.arcane.iris.generation.hydrology.water.PondKind;
|
||||
@@ -219,18 +218,6 @@ final class HydrologyFeatureSearch {
|
||||
pond(pond, type);
|
||||
}
|
||||
}
|
||||
if (types.contains(HydrologyFeatureType.SEA_INLET)) {
|
||||
for (SeaInlet inlet : plan.inlets()) {
|
||||
inlet(inlet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void inlet(SeaInlet inlet) {
|
||||
for (int station = 0; station < inlet.stations(); station++) {
|
||||
offer(inlet.id(), HydrologyFeatureType.SEA_INLET, (int) Math.floor(inlet.xs()[station]), inlet.waterLevel(),
|
||||
(int) Math.floor(inlet.zs()[station]));
|
||||
}
|
||||
}
|
||||
|
||||
private HydrologyFeatureType pondType(Pond pond) {
|
||||
@@ -244,6 +231,12 @@ final class HydrologyFeatureSearch {
|
||||
}
|
||||
|
||||
private void reach(Reach reach) {
|
||||
if (reach.style()[0] == ReachStyle.TIDAL) {
|
||||
if (types.contains(HydrologyFeatureType.SEA_INLET)) {
|
||||
tidal(reach);
|
||||
}
|
||||
return;
|
||||
}
|
||||
HydrologyFeatureType channel = channelType(settings, reach.tier());
|
||||
boolean whole = types.contains(channel);
|
||||
float[] xs = reach.xs();
|
||||
@@ -257,6 +250,12 @@ final class HydrologyFeatureSearch {
|
||||
}
|
||||
}
|
||||
|
||||
private void tidal(Reach reach) {
|
||||
for (int index = 0; index < reach.xs().length; index++) {
|
||||
offer(reach.id(), HydrologyFeatureType.SEA_INLET, (int) Math.floor(reach.xs()[index]), reach.grade()[index], (int) Math.floor(reach.zs()[index]));
|
||||
}
|
||||
}
|
||||
|
||||
private void pond(Pond pond, HydrologyFeatureType type) {
|
||||
PondMask mask = pond.mask();
|
||||
for (int j = 0; j < mask.depth(); j++) {
|
||||
@@ -306,7 +305,7 @@ final class HydrologyFeatureSearch {
|
||||
case CASCADE -> HydrologyFeatureType.CASCADE;
|
||||
case WATERFALL -> HydrologyFeatureType.WATERFALL;
|
||||
case MOUTH -> HydrologyFeatureType.MOUTH;
|
||||
case RUN, RIFFLE, POND_OUTLET -> null;
|
||||
case RUN, RIFFLE, POND_OUTLET, TIDAL -> null;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+3
-5
@@ -1,20 +1,18 @@
|
||||
package art.arcane.iris.generation.hydrology.engine;
|
||||
|
||||
import art.arcane.iris.generation.hydrology.underground.SeaInlet;
|
||||
import art.arcane.iris.generation.hydrology.water.Pond;
|
||||
import art.arcane.iris.generation.hydrology.water.Reach;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public record HydrologyPlanPreview(List<Reach> reaches, List<Pond> ponds, List<Pond> lakes, List<SeaInlet> inlets, boolean complete) {
|
||||
public static final HydrologyPlanPreview EMPTY = new HydrologyPlanPreview(List.of(), List.of(), List.of(), List.of(), true);
|
||||
public static final HydrologyPlanPreview PENDING = new HydrologyPlanPreview(List.of(), List.of(), List.of(), List.of(), false);
|
||||
public record HydrologyPlanPreview(List<Reach> reaches, List<Pond> ponds, List<Pond> lakes, boolean complete) {
|
||||
public static final HydrologyPlanPreview EMPTY = new HydrologyPlanPreview(List.of(), List.of(), List.of(), true);
|
||||
public static final HydrologyPlanPreview PENDING = new HydrologyPlanPreview(List.of(), List.of(), List.of(), false);
|
||||
|
||||
public HydrologyPlanPreview {
|
||||
reaches = List.copyOf(Objects.requireNonNull(reaches, "reaches"));
|
||||
ponds = List.copyOf(Objects.requireNonNull(ponds, "ponds"));
|
||||
lakes = List.copyOf(Objects.requireNonNull(lakes, "lakes"));
|
||||
inlets = List.copyOf(Objects.requireNonNull(inlets, "inlets"));
|
||||
}
|
||||
}
|
||||
+2
-23
@@ -20,7 +20,6 @@ import art.arcane.iris.generation.hydrology.raster.ChunkRasterizer;
|
||||
import art.arcane.iris.generation.hydrology.raster.ChunkWaterRaster;
|
||||
import art.arcane.iris.generation.hydrology.raster.NaturalHeights;
|
||||
import art.arcane.iris.generation.hydrology.underground.SeaInlet;
|
||||
import art.arcane.iris.generation.hydrology.underground.SeaInletRasterizer;
|
||||
import art.arcane.iris.generation.hydrology.water.HydrologyTier;
|
||||
import art.arcane.iris.generation.hydrology.water.Pond;
|
||||
import art.arcane.iris.generation.hydrology.water.Reach;
|
||||
@@ -307,7 +306,6 @@ public final class HydrologyRuntime {
|
||||
boolean complete = true;
|
||||
List<Reach> reaches = new ArrayList<>();
|
||||
List<Pond> ponds = new ArrayList<>();
|
||||
List<SeaInlet> inlets = new ArrayList<>();
|
||||
for (int wz = min.wz() - 1; wz <= max.wz() + 1; wz++) {
|
||||
for (int wx = min.wx() - 1; wx <= max.wx() + 1; wx++) {
|
||||
WindowKey window = new WindowKey(wx, wz);
|
||||
@@ -315,7 +313,6 @@ public final class HydrologyRuntime {
|
||||
if (plan.isPresent()) {
|
||||
reaches.addAll(plan.get().plan().reaches());
|
||||
ponds.addAll(plan.get().plan().ponds());
|
||||
inlets.addAll(plan.get().plan().inlets());
|
||||
} else {
|
||||
complete = false;
|
||||
requestPreview(window, windowPreviewFailures, key(wx, wz), "window " + wx + "," + wz, () -> cache.previewWindow(window));
|
||||
@@ -335,7 +332,7 @@ public final class HydrologyRuntime {
|
||||
() -> cache.previewRegion(region));
|
||||
}
|
||||
}
|
||||
return new HydrologyPlanPreview(reaches, ponds, List.copyOf(lakes.values()), inlets, complete);
|
||||
return new HydrologyPlanPreview(reaches, ponds, List.copyOf(lakes.values()), complete);
|
||||
}
|
||||
|
||||
public ChunkWaterRaster rasterAt(int blockX, int blockZ) {
|
||||
@@ -442,25 +439,7 @@ public final class HydrologyRuntime {
|
||||
}
|
||||
|
||||
public List<SeaInlet> inlets(int chunkX, int chunkZ) {
|
||||
if (cache == null) {
|
||||
return List.of();
|
||||
}
|
||||
requireOpen();
|
||||
boolean main = mainThread.getAsBoolean();
|
||||
List<SeaInlet> touching = new ArrayList<>();
|
||||
for (CompletableFuture<IndexedWindow> plan : plans(neighbourhood(chunkX, chunkZ), List.of(), PlanMode.DEMAND).windowFutures()) {
|
||||
if (main && !plan.isDone()) {
|
||||
throw new IllegalStateException("The hydrology windows around chunk " + chunkX + "," + chunkZ
|
||||
+ " are not planned yet, so its sea inlets cannot be generated on the main thread.");
|
||||
}
|
||||
IndexedWindow window = main ? plan.join() : cache.awaitPlan(plan);
|
||||
for (SeaInlet inlet : window.plan().inlets()) {
|
||||
if (SeaInletRasterizer.touches(inlet, chunkX, chunkZ)) {
|
||||
touching.add(inlet);
|
||||
}
|
||||
}
|
||||
}
|
||||
return touching;
|
||||
return List.of();
|
||||
}
|
||||
|
||||
public Set<HydrologyFeatureType> standingWaterTypes(int chunkX, int chunkZ, long featureId) {
|
||||
|
||||
+14
-66
@@ -1,6 +1,5 @@
|
||||
package art.arcane.iris.generation.hydrology.plan;
|
||||
|
||||
import art.arcane.iris.generation.hydrology.underground.SeaInlet;
|
||||
import art.arcane.iris.generation.hydrology.water.HydrologyTier;
|
||||
import art.arcane.iris.generation.hydrology.water.Pond;
|
||||
import art.arcane.iris.generation.hydrology.water.PondKind;
|
||||
@@ -26,31 +25,27 @@ public final class HydrologyPlanCodec {
|
||||
private static final int POINT_BYTES = 5 * Integer.BYTES + 1;
|
||||
private static final int REACH_BYTES = 2 * Long.BYTES + 4 * Integer.BYTES + 2 * POINT_BYTES;
|
||||
private static final int POND_BYTES = 2 * Long.BYTES + 1 + 15 * Integer.BYTES;
|
||||
private static final int STATION_BYTES = 5 * Integer.BYTES;
|
||||
private static final int INLET_BYTES = Long.BYTES + 5 * Integer.BYTES + 2 * STATION_BYTES;
|
||||
|
||||
private HydrologyPlanCodec() {
|
||||
}
|
||||
|
||||
public static byte[] encode(HydrologySettings settings, WindowPlan plan) {
|
||||
return encode(settings, WINDOW, plan.key().wx(), plan.key().wz(), plan.reaches(), plan.ponds(), plan.inlets());
|
||||
return encode(settings, WINDOW, plan.key().wx(), plan.key().wz(), plan.reaches(), plan.ponds());
|
||||
}
|
||||
|
||||
public static byte[] encode(HydrologySettings settings, RegionPlan plan) {
|
||||
return encode(settings, REGION, plan.key().rx(), plan.key().rz(), plan.majorReaches(), plan.lakes(), List.of());
|
||||
return encode(settings, REGION, plan.key().rx(), plan.key().rz(), plan.majorReaches(), plan.lakes());
|
||||
}
|
||||
|
||||
public static Optional<WindowPlan> decodeWindow(HydrologySettings settings, byte[] data) {
|
||||
return decode(settings, WINDOW, data).map(body -> new WindowPlan(new WindowKey(body.x(), body.z()), body.reaches(), body.ponds(),
|
||||
body.inlets()));
|
||||
return decode(settings, WINDOW, data).map(body -> new WindowPlan(new WindowKey(body.x(), body.z()), body.reaches(), body.ponds()));
|
||||
}
|
||||
|
||||
public static Optional<RegionPlan> decodeRegion(HydrologySettings settings, byte[] data) {
|
||||
return decode(settings, REGION, data).map(body -> new RegionPlan(new RegionKey(body.x(), body.z()), body.reaches(), body.ponds()));
|
||||
}
|
||||
|
||||
private static byte[] encode(HydrologySettings settings, byte kind, int x, int z, List<Reach> reaches, List<Pond> ponds,
|
||||
List<SeaInlet> inlets) {
|
||||
private static byte[] encode(HydrologySettings settings, byte kind, int x, int z, List<Reach> reaches, List<Pond> ponds) {
|
||||
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||
try (DataOutputStream out = new DataOutputStream(bytes)) {
|
||||
out.writeInt(MAGIC);
|
||||
@@ -66,12 +61,6 @@ public final class HydrologyPlanCodec {
|
||||
for (Pond pond : ponds) {
|
||||
writePond(out, pond);
|
||||
}
|
||||
if (kind == WINDOW) {
|
||||
out.writeInt(inlets.size());
|
||||
for (SeaInlet inlet : inlets) {
|
||||
writeInlet(out, inlet);
|
||||
}
|
||||
}
|
||||
} catch (IOException failure) {
|
||||
throw new UncheckedIOException(failure);
|
||||
}
|
||||
@@ -79,6 +68,9 @@ public final class HydrologyPlanCodec {
|
||||
}
|
||||
|
||||
private static int tierIndex(HydrologySettings settings, Reach reach) {
|
||||
if (reach.tier().equals(settings.tidalTier())) {
|
||||
return settings.tiers().size();
|
||||
}
|
||||
int index = settings.tiers().indexOf(reach.tier());
|
||||
if (index < 0) {
|
||||
throw new IllegalArgumentException("Reach " + reach.id() + " uses tier " + reach.tier().name() + ", which is not in the settings.");
|
||||
@@ -139,24 +131,6 @@ public final class HydrologyPlanCodec {
|
||||
out.writeInt(pond.floorZ());
|
||||
}
|
||||
|
||||
private static void writeInlet(DataOutputStream out, SeaInlet inlet) throws IOException {
|
||||
out.writeLong(inlet.id());
|
||||
out.writeInt(inlet.waterLevel());
|
||||
out.writeInt(inlet.chamberX());
|
||||
out.writeInt(inlet.chamberZ());
|
||||
out.writeInt(inlet.chamberRadius());
|
||||
out.writeInt(inlet.stations());
|
||||
writeFloats(out, inlet.xs());
|
||||
writeFloats(out, inlet.zs());
|
||||
writeFloats(out, inlet.halfWidth());
|
||||
for (int floor : inlet.floor()) {
|
||||
out.writeInt(floor);
|
||||
}
|
||||
for (int ceiling : inlet.ceiling()) {
|
||||
out.writeInt(ceiling);
|
||||
}
|
||||
}
|
||||
|
||||
private static void writeFloats(DataOutputStream out, float[] values) throws IOException {
|
||||
for (float value : values) {
|
||||
out.writeInt(Float.floatToRawIntBits(value));
|
||||
@@ -174,33 +148,28 @@ public final class HydrologyPlanCodec {
|
||||
int reachCount = count(in, REACH_BYTES);
|
||||
List<Reach> reaches = new ArrayList<>(reachCount);
|
||||
for (int index = 0; index < reachCount; index++) {
|
||||
reaches.add(readReach(in, settings.tiers()));
|
||||
reaches.add(readReach(in, settings));
|
||||
}
|
||||
int pondCount = count(in, POND_BYTES);
|
||||
List<Pond> ponds = new ArrayList<>(pondCount);
|
||||
for (int index = 0; index < pondCount; index++) {
|
||||
ponds.add(readPond(in));
|
||||
}
|
||||
List<SeaInlet> inlets = new ArrayList<>();
|
||||
if (kind == WINDOW) {
|
||||
int inletCount = count(in, INLET_BYTES);
|
||||
for (int index = 0; index < inletCount; index++) {
|
||||
inlets.add(readInlet(in));
|
||||
}
|
||||
}
|
||||
if (in.hasRemaining()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
return Optional.of(new Body(x, z, reaches, ponds, inlets));
|
||||
return Optional.of(new Body(x, z, reaches, ponds));
|
||||
} catch (BufferUnderflowException | IllegalArgumentException | IllegalStateException malformed) {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
private static Reach readReach(ByteBuffer in, List<HydrologyTier> tiers) {
|
||||
private static Reach readReach(ByteBuffer in, HydrologySettings settings) {
|
||||
long id = in.getLong();
|
||||
long downstreamId = in.getLong();
|
||||
HydrologyTier tier = tiers.get(index(in.getInt(), tiers.size()));
|
||||
List<HydrologyTier> tiers = settings.tiers();
|
||||
int tierIndex = index(in.getInt(), tiers.size() + 1);
|
||||
HydrologyTier tier = tierIndex == tiers.size() ? settings.tidalTier() : tiers.get(tierIndex);
|
||||
float catchment = Float.intBitsToFloat(in.getInt());
|
||||
int points = count(in, POINT_BYTES);
|
||||
float[] xs = readFloats(in, points);
|
||||
@@ -246,27 +215,6 @@ public final class HydrologyPlanCodec {
|
||||
return new Pond(id, kind, level, floor, spillX, spillZ, spillHeight, mask, outletReachId, damRaise, fluid, in.getInt(), in.getInt());
|
||||
}
|
||||
|
||||
private static SeaInlet readInlet(ByteBuffer in) {
|
||||
long id = in.getLong();
|
||||
int waterLevel = in.getInt();
|
||||
int chamberX = in.getInt();
|
||||
int chamberZ = in.getInt();
|
||||
int chamberRadius = in.getInt();
|
||||
int stations = count(in, STATION_BYTES);
|
||||
float[] xs = readFloats(in, stations);
|
||||
float[] zs = readFloats(in, stations);
|
||||
float[] halfWidth = readFloats(in, stations);
|
||||
int[] floor = new int[stations];
|
||||
for (int station = 0; station < stations; station++) {
|
||||
floor[station] = in.getInt();
|
||||
}
|
||||
int[] ceiling = new int[stations];
|
||||
for (int station = 0; station < stations; station++) {
|
||||
ceiling[station] = in.getInt();
|
||||
}
|
||||
return new SeaInlet(id, xs, zs, halfWidth, waterLevel, floor, ceiling, chamberX, chamberZ, chamberRadius);
|
||||
}
|
||||
|
||||
private static String readString(ByteBuffer in) {
|
||||
int length = in.getInt();
|
||||
if (length == -1) {
|
||||
@@ -303,6 +251,6 @@ public final class HydrologyPlanCodec {
|
||||
return value;
|
||||
}
|
||||
|
||||
private record Body(int x, int z, List<Reach> reaches, List<Pond> ponds, List<SeaInlet> inlets) {
|
||||
private record Body(int x, int z, List<Reach> reaches, List<Pond> ponds) {
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,8 @@ public final class HydrologySettings {
|
||||
private static final int MAX_DELTA_LENGTH = 384;
|
||||
public static final float MAX_HALF_WIDTH = 64f;
|
||||
public static final int DELTA_STEP = 2;
|
||||
private static final int TIDAL_BASE_TIER = 1;
|
||||
private static final String TIDAL_TIER_NAME = "tidal";
|
||||
private static final double MIN_INLET_MOUTH = 2D;
|
||||
private static final double MAX_INLET_MOUTH = 32D;
|
||||
private static final double MIN_INLET_HEAD = 1D;
|
||||
@@ -94,6 +96,7 @@ public final class HydrologySettings {
|
||||
private final Lakes lakes;
|
||||
private final Deformation deformation;
|
||||
private final Underground underground;
|
||||
private final HydrologyTier tidalTier;
|
||||
private final Map<String, IrisMaterialPalette> fluids;
|
||||
private final Map<String, String> seams;
|
||||
private final int prefetchRings;
|
||||
@@ -117,6 +120,7 @@ public final class HydrologySettings {
|
||||
this.lakes = lakes(config.getLakes());
|
||||
this.deformation = deformation(config.getDeformation());
|
||||
this.underground = underground(config.getUnderground());
|
||||
this.tidalTier = tidalTier(tiers.get(Math.min(TIDAL_BASE_TIER, tiers.size() - 1)), underground.seaInlets());
|
||||
this.fluids = fluids(config.getFluids());
|
||||
this.seams = seams(config.getFluids());
|
||||
this.prefetchRings = config.getPrefetchRings();
|
||||
@@ -138,6 +142,10 @@ public final class HydrologySettings {
|
||||
return tiers;
|
||||
}
|
||||
|
||||
public HydrologyTier tidalTier() {
|
||||
return tidalTier;
|
||||
}
|
||||
|
||||
public HydrologyTier majorTier() {
|
||||
return tiers.get(tiers.size() - 1);
|
||||
}
|
||||
@@ -216,6 +224,12 @@ public final class HydrologySettings {
|
||||
return persist;
|
||||
}
|
||||
|
||||
private static HydrologyTier tidalTier(HydrologyTier base, SeaInlets inlets) {
|
||||
return new HydrologyTier(TIDAL_TIER_NAME, base.minCatchment(), inlets.meanderWidth(), inlets.meanderWidth(), 0f, base.depthRatio(), 0, false,
|
||||
base.waterfallMinimumDrop(), base.stepHeight(), inlets.bankBand(), inlets.bankStyle(), new HydrologyTier.Estuary(0, 1f),
|
||||
new HydrologyTier.Delta(0, 0f, 0), base.materials(), base.fluid(), base.decorators());
|
||||
}
|
||||
|
||||
private static Climate climate(IrisHydrologyClimate config) {
|
||||
Objects.requireNonNull(config, "Hydrology climate is missing");
|
||||
IrisGeneratorStyle style = Objects.requireNonNull(config.getStyle(), "Hydrology climate.style is missing");
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
package art.arcane.iris.generation.hydrology.plan;
|
||||
|
||||
import art.arcane.iris.generation.hydrology.underground.SeaInlet;
|
||||
import art.arcane.iris.generation.hydrology.water.Pond;
|
||||
import art.arcane.iris.generation.hydrology.water.Reach;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public record WindowPlan(WindowKey key, List<Reach> reaches, List<Pond> ponds, List<SeaInlet> inlets) {
|
||||
public record WindowPlan(WindowKey key, List<Reach> reaches, List<Pond> ponds) {
|
||||
public WindowPlan {
|
||||
Objects.requireNonNull(key, "key");
|
||||
reaches = List.copyOf(reaches);
|
||||
ponds = List.copyOf(ponds);
|
||||
inlets = List.copyOf(inlets);
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,6 @@ import art.arcane.iris.generation.hydrology.grid.HydrologySampleBuffer;
|
||||
import art.arcane.iris.generation.hydrology.grid.PriorityFlood;
|
||||
import art.arcane.iris.generation.hydrology.raster.PondChannelSettlement;
|
||||
import art.arcane.iris.generation.hydrology.raster.TongueGuard;
|
||||
import art.arcane.iris.generation.hydrology.underground.SeaInlet;
|
||||
import art.arcane.iris.generation.hydrology.underground.SeaInletPlanner;
|
||||
import art.arcane.iris.generation.hydrology.water.CupSet;
|
||||
import art.arcane.iris.generation.hydrology.water.Pond;
|
||||
import art.arcane.iris.generation.hydrology.water.PondKind;
|
||||
@@ -49,14 +47,12 @@ public final class WindowPlanner {
|
||||
private final HeightLattice fine;
|
||||
private final PondPlanner ponds;
|
||||
private final ReachShaper shaper;
|
||||
private final SeaInletPlanner inlets;
|
||||
|
||||
public WindowPlanner(HydrologySettings settings, HeightLattice fine, PondPlanner ponds, ReachShaper shaper) {
|
||||
this.settings = Objects.requireNonNull(settings, "settings");
|
||||
this.fine = Objects.requireNonNull(fine, "fine");
|
||||
this.ponds = Objects.requireNonNull(ponds, "ponds");
|
||||
this.shaper = Objects.requireNonNull(shaper, "shaper");
|
||||
this.inlets = new SeaInletPlanner(settings);
|
||||
if (fine.cell() != FINE_CELL) {
|
||||
throw new IllegalArgumentException("Window fine lattice cell " + fine.cell() + " must be " + FINE_CELL);
|
||||
}
|
||||
@@ -131,8 +127,7 @@ public final class WindowPlanner {
|
||||
}
|
||||
List<Reach> reaches = network.reaches();
|
||||
List<Pond> windowPonds = windowPonds(network.ponds());
|
||||
List<SeaInlet> planned = inlets.plan(key, raw, samples, drainage.receivers(), drainage.accumulation(), network, settings.seed());
|
||||
WindowPlan owned = new WindowPlan(key, ownedReaches(key, reaches), ownedPonds(key, windowPonds), ownedInlets(key, planned));
|
||||
WindowPlan owned = new WindowPlan(key, ownedReaches(key, reaches), ownedPonds(key, windowPonds));
|
||||
requireSeaConnectedHeads(owned, settings.seaLevel());
|
||||
return new WindowComputation(owned, reaches, windowPonds);
|
||||
}
|
||||
@@ -356,24 +351,11 @@ public final class WindowPlanner {
|
||||
return owned;
|
||||
}
|
||||
|
||||
private static List<SeaInlet> ownedInlets(WindowKey key, List<SeaInlet> planned) {
|
||||
List<SeaInlet> owned = new ArrayList<>();
|
||||
for (SeaInlet inlet : planned) {
|
||||
if (key.equals(WindowKey.containing((int) Math.floor(inlet.xs()[1]), (int) Math.floor(inlet.zs()[1])))) {
|
||||
owned.add(inlet);
|
||||
}
|
||||
}
|
||||
return owned;
|
||||
}
|
||||
|
||||
private static void requireSeaConnectedHeads(WindowPlan plan, int seaLevel) {
|
||||
for (SeaInlet inlet : plan.inlets()) {
|
||||
if (inlet.waterLevel() != seaLevel) {
|
||||
throw new IllegalStateException("Window " + plan.key() + " sea inlet " + inlet.id() + " holds water at " + inlet.waterLevel()
|
||||
+ ", not at sea level " + seaLevel);
|
||||
}
|
||||
}
|
||||
static void requireSeaConnectedHeads(WindowPlan plan, int seaLevel) {
|
||||
for (Reach reach : plan.reaches()) {
|
||||
if (requireTidal(plan.key(), reach, seaLevel)) {
|
||||
continue;
|
||||
}
|
||||
int mouth = reach.grade().length;
|
||||
while (mouth > 0 && reach.style()[mouth - 1] == ReachStyle.MOUTH) {
|
||||
mouth--;
|
||||
@@ -401,6 +383,30 @@ public final class WindowPlanner {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean requireTidal(WindowKey key, Reach reach, int seaLevel) {
|
||||
boolean any = false;
|
||||
boolean all = true;
|
||||
for (ReachStyle style : reach.style()) {
|
||||
any |= style == ReachStyle.TIDAL;
|
||||
all &= style == ReachStyle.TIDAL;
|
||||
}
|
||||
if (!any) {
|
||||
return false;
|
||||
}
|
||||
if (!all) {
|
||||
throw new IllegalStateException("Window " + key + " sea inlet " + reach.id() + " mixes tidal water with other water styles");
|
||||
}
|
||||
if (reach.downstreamId() != 0L) {
|
||||
throw offSea(key, reach, reach.grade().length - 1, ", but a sea inlet drains into reach " + reach.downstreamId() + " instead of the sea");
|
||||
}
|
||||
for (int point = 0; point < reach.grade().length; point++) {
|
||||
if (reach.grade()[point] != seaLevel) {
|
||||
throw offSea(key, reach, point, ", but a sea inlet stands at sea level " + seaLevel);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static IllegalStateException offSea(WindowKey key, Reach reach, int point, String rule) {
|
||||
return new IllegalStateException("Window " + key + " reach " + reach.id() + " " + reach.style()[point] + " point " + point + " at "
|
||||
+ reach.xs()[point] + "," + reach.zs()[point] + " is graded " + reach.grade()[point] + rule);
|
||||
|
||||
@@ -5,8 +5,6 @@ import art.arcane.iris.generation.hydrology.plan.IndexedWindow;
|
||||
import art.arcane.iris.generation.hydrology.plan.RegionKey;
|
||||
import art.arcane.iris.generation.hydrology.plan.RegionPlan;
|
||||
import art.arcane.iris.generation.hydrology.plan.WindowKey;
|
||||
import art.arcane.iris.generation.hydrology.underground.SeaInlet;
|
||||
import art.arcane.iris.generation.hydrology.underground.SeaInletRasterizer;
|
||||
import art.arcane.iris.generation.hydrology.water.ConfluenceGrader;
|
||||
import art.arcane.iris.generation.hydrology.water.Pond;
|
||||
import art.arcane.iris.generation.hydrology.water.PondMask;
|
||||
@@ -14,7 +12,6 @@ import art.arcane.iris.generation.hydrology.water.Reach;
|
||||
import art.arcane.iris.generation.hydrology.water.ReachStyle;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.IdentityHashMap;
|
||||
@@ -31,8 +28,6 @@ final class ChunkFeatures {
|
||||
private final List<Reach> reaches;
|
||||
private final List<Pond> ponds;
|
||||
private final List<Pond> lakes;
|
||||
private final List<SeaInlet> inlets;
|
||||
private final int[] inletBoxes;
|
||||
private final int[] lakeBoxes;
|
||||
private final ReachSegments segments = new ReachSegments(SEGMENT_CAPACITY);
|
||||
private final ReachGeometry.Lookup brinks;
|
||||
@@ -41,14 +36,11 @@ final class ChunkFeatures {
|
||||
private final MaskEdges lakeReach = new MaskEdges(MaskEdges.Kind.GROWN_WATER);
|
||||
private boolean inert;
|
||||
|
||||
private ChunkFeatures(HydrologySettings settings, List<Reach> reaches, Map<Reach, Reach> plans, List<Pond> ponds, List<Pond> lakes,
|
||||
List<SeaInlet> inlets, int[] inletBoxes) {
|
||||
private ChunkFeatures(HydrologySettings settings, List<Reach> reaches, Map<Reach, Reach> plans, List<Pond> ponds, List<Pond> lakes) {
|
||||
this.brinks = new ReachGeometry.Lookup(settings.seed(), settings.seaLevel(), plans);
|
||||
this.reaches = reaches;
|
||||
this.ponds = ponds;
|
||||
this.lakes = lakes;
|
||||
this.inlets = inlets;
|
||||
this.inletBoxes = inletBoxes;
|
||||
this.lakeBoxes = new int[4 * lakes.size()];
|
||||
}
|
||||
|
||||
@@ -58,19 +50,7 @@ final class ChunkFeatures {
|
||||
List<Reach> reaches = new ArrayList<>();
|
||||
Map<Reach, Reach> plans = new IdentityHashMap<>();
|
||||
List<Pond> ponds = new ArrayList<>();
|
||||
List<SeaInlet> inlets = new ArrayList<>();
|
||||
int[] inletBoxes = new int[0];
|
||||
for (IndexedWindow window : windows) {
|
||||
for (SeaInlet inlet : window.plan().inlets()) {
|
||||
int[] bounds = SeaInletRasterizer.bounds(inlet);
|
||||
int padding = RiffleProfile.RADIUS + 1;
|
||||
if (bounds[0] <= chunkX * CHUNK + CHUNK - 1 + padding && bounds[2] >= chunkX * CHUNK - padding
|
||||
&& bounds[1] <= chunkZ * CHUNK + CHUNK - 1 + padding && bounds[3] >= chunkZ * CHUNK - padding) {
|
||||
inletBoxes = Arrays.copyOf(inletBoxes, inletBoxes.length + 4);
|
||||
System.arraycopy(bounds, 0, inletBoxes, 4 * inlets.size(), 4);
|
||||
inlets.add(inlet);
|
||||
}
|
||||
}
|
||||
int before = reaches.size();
|
||||
window.index().candidates(chunkX, chunkZ, halo, reaches, ponds);
|
||||
for (int index = before; index < reaches.size(); index++) {
|
||||
@@ -81,7 +61,7 @@ final class ChunkFeatures {
|
||||
}
|
||||
}
|
||||
List<Pond> lakes = lakes(chunkX, chunkZ, halo, lakeRegionPlans, lakeRegions);
|
||||
ChunkFeatures features = new ChunkFeatures(settings, reaches, plans, ponds, lakes, inlets, inletBoxes);
|
||||
ChunkFeatures features = new ChunkFeatures(settings, reaches, plans, ponds, lakes);
|
||||
features.index(settings, chunkX, chunkZ);
|
||||
return features;
|
||||
}
|
||||
@@ -90,20 +70,6 @@ final class ChunkFeatures {
|
||||
return inert;
|
||||
}
|
||||
|
||||
SeaInlet openInletAt(int x, int z, int[] column) {
|
||||
for (int index = 0; index < inlets.size(); index++) {
|
||||
int box = 4 * index;
|
||||
if (x < inletBoxes[box] || z < inletBoxes[box + 1] || x > inletBoxes[box + 2] || z > inletBoxes[box + 3]) {
|
||||
continue;
|
||||
}
|
||||
SeaInlet inlet = inlets.get(index);
|
||||
if (SeaInletRasterizer.column(inlet, x, z, column) && column[1] == SeaInlet.OPEN) {
|
||||
return inlet;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
ReachGeometry.Lookup brinks() {
|
||||
return brinks;
|
||||
}
|
||||
@@ -123,11 +89,6 @@ final class ChunkFeatures {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (SeaInlet inlet : inlets) {
|
||||
if (WaterHeads.standing(inlet.waterLevel(), seaLevel) != head) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return segments.hasOnlyLevel(head, seaLevel);
|
||||
}
|
||||
|
||||
@@ -220,20 +181,11 @@ final class ChunkFeatures {
|
||||
lakeReach.collect(mask, minX - shoreReach, minZ - shoreReach, maxX + shoreReach, maxZ + shoreReach);
|
||||
System.arraycopy(grownBox(mask), 0, lakeBoxes, 4 * index, 4);
|
||||
}
|
||||
inert = segments.isEmpty() && !inletsTouch(minX - 1, minZ - 1, maxX + 1, maxZ + 1)
|
||||
inert = segments.isEmpty()
|
||||
&& !pondsTouch(minX - 1 - reach, minZ - 1 - reach, maxX + 1 + reach, maxZ + 1 + reach)
|
||||
&& !lakesTouch(minX - 2 - shoreReach, minZ - 2 - shoreReach, maxX + 2 + shoreReach, maxZ + 2 + shoreReach);
|
||||
}
|
||||
|
||||
private boolean inletsTouch(int minX, int minZ, int maxX, int maxZ) {
|
||||
for (int box = 0; box < inletBoxes.length; box += 4) {
|
||||
if (inletBoxes[box] <= maxX && inletBoxes[box + 2] >= minX && inletBoxes[box + 1] <= maxZ && inletBoxes[box + 3] >= minZ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean pondsTouch(int minX, int minZ, int maxX, int maxZ) {
|
||||
for (Pond pond : ponds) {
|
||||
PondMask mask = pond.mask();
|
||||
|
||||
@@ -20,7 +20,7 @@ public final class ChunkRasterizer {
|
||||
public ChunkRasterizer(HydrologySettings settings, ChannelFluids channelFluids) {
|
||||
this.settings = Objects.requireNonNull(settings, "settings");
|
||||
this.channelFluids = Objects.requireNonNull(channelFluids, "channelFluids");
|
||||
float widest = 0f;
|
||||
float widest = settings.underground().seaInlets().mouthHalfWidth().max();
|
||||
for (HydrologyTier tier : settings.tiers()) {
|
||||
widest = Math.max(widest, tier.maxHalfWidth());
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package art.arcane.iris.generation.hydrology.raster;
|
||||
import art.arcane.iris.generation.hydrology.config.IrisBankStyle;
|
||||
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveCell;
|
||||
import art.arcane.iris.generation.hydrology.plan.HydrologySettings;
|
||||
import art.arcane.iris.generation.hydrology.underground.SeaInlet;
|
||||
import art.arcane.iris.generation.hydrology.water.HydrologyTier;
|
||||
import art.arcane.iris.generation.hydrology.water.Pond;
|
||||
import art.arcane.iris.generation.hydrology.water.Reach;
|
||||
@@ -44,7 +43,6 @@ final class RasterComposer {
|
||||
private final HydrologyTier[] nearTier = new HydrologyTier[CELLS];
|
||||
private final ReachGeometry.Lookup brinks;
|
||||
private final ReachCursor cursor;
|
||||
private final int[] inletColumn = new int[2];
|
||||
private final Map<Long, String> reachFluids = new HashMap<>();
|
||||
private NaturalHeights naturalHeight;
|
||||
|
||||
@@ -89,15 +87,6 @@ final class RasterComposer {
|
||||
int x = originX + cell % GRID;
|
||||
int z = originZ + cell / GRID;
|
||||
int ground = natural[cell];
|
||||
SeaInlet inlet = features.openInletAt(x, z, inletColumn);
|
||||
if (inlet != null) {
|
||||
head[cell] = WaterHeads.standing(inlet.waterLevel(), settings.seaLevel());
|
||||
terrain[cell] = Math.min(Math.min(ground, inletColumn[0]), head[cell] - 1);
|
||||
role[cell] = WaterRole.INLET;
|
||||
feature[cell] = inlet.id();
|
||||
fluid[cell] = HydrologyCaveCell.SEA_FLUID;
|
||||
return;
|
||||
}
|
||||
int lake = features.lakeAt(x, z, ground);
|
||||
int pondIndex = lake >= 0 ? -1 : features.pondAt(x, z);
|
||||
boolean shore = interior(cell) && lake < 0 && pondIndex < 0;
|
||||
@@ -149,7 +138,7 @@ final class RasterComposer {
|
||||
role[cell] = role(reach.style()[point]);
|
||||
feature[cell] = reach.id();
|
||||
tier[cell] = reach.tier();
|
||||
fluid[cell] = role[cell] == WaterRole.MOUTH ? HydrologyCaveCell.SEA_FLUID : reachFluid(reach);
|
||||
fluid[cell] = role[cell] == WaterRole.MOUTH || role[cell] == WaterRole.INLET ? HydrologyCaveCell.SEA_FLUID : reachFluid(reach);
|
||||
}
|
||||
|
||||
private String reachFluid(Reach reach) {
|
||||
@@ -334,11 +323,6 @@ final class RasterComposer {
|
||||
sample.set(head[cell], feature[cell], role[cell]);
|
||||
return;
|
||||
}
|
||||
SeaInlet inlet = features.openInletAt(x, z, inletColumn);
|
||||
if (inlet != null) {
|
||||
sample.set(WaterHeads.standing(inlet.waterLevel(), settings.seaLevel()), inlet.id(), WaterRole.INLET);
|
||||
return;
|
||||
}
|
||||
int lake = features.lakeCovers(x, z) ? features.lakeAt(x, z, naturalAt(x, z)) : -1;
|
||||
if (lake >= 0) {
|
||||
sample.set(WaterHeads.standing(features.lake(lake).level(), settings.seaLevel()), features.lake(lake).id(), WaterRole.POND);
|
||||
@@ -524,6 +508,7 @@ final class RasterComposer {
|
||||
case CASCADE -> WaterRole.CASCADE;
|
||||
case WATERFALL -> WaterRole.WATERFALL;
|
||||
case MOUTH -> WaterRole.MOUTH;
|
||||
case TIDAL -> WaterRole.INLET;
|
||||
case RUN, RIFFLE, POND_OUTLET -> WaterRole.CHANNEL;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@ public enum ReachStyle {
|
||||
CASCADE(2),
|
||||
WATERFALL(3),
|
||||
POND_OUTLET(4),
|
||||
MOUTH(5);
|
||||
MOUTH(5),
|
||||
TIDAL(6);
|
||||
|
||||
private static final PersistedCodes<ReachStyle> CODES = PersistedCodes.of(ReachStyle.class, ReachStyle::code);
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ final class HydrologyVegetationSource {
|
||||
for (HydrologyTier tier : settings.tiers()) {
|
||||
tiers.put(tier, HydrologyVegetation.Decorators.compile(tier.decorators(), data, "Hydrology tier '" + tier.name() + "' decorators"));
|
||||
}
|
||||
tiers.put(settings.tidalTier(), tiers.get(settings.tiers().get(Math.min(1, settings.tiers().size() - 1))));
|
||||
HydrologyVegetationSource source = new HydrologyVegetationSource(data, dimension, tiers,
|
||||
HydrologyVegetation.Decorators.compile(settings.ponds().decorators(), data, "Hydrology ponds.decorators"));
|
||||
source.planted = !source.ponds.empty();
|
||||
|
||||
@@ -4,11 +4,11 @@ import art.arcane.iris.generation.hydrology.engine.HydrologyPlanPreview;
|
||||
import art.arcane.iris.generation.hydrology.engine.HydrologyRuntime;
|
||||
import art.arcane.iris.generation.hydrology.query.HydrologyFeatureType;
|
||||
import art.arcane.iris.generation.hydrology.raster.ChunkWaterRaster;
|
||||
import art.arcane.iris.generation.hydrology.underground.SeaInlet;
|
||||
import art.arcane.iris.generation.hydrology.water.HydrologyTier;
|
||||
import art.arcane.iris.generation.hydrology.water.Pond;
|
||||
import art.arcane.iris.generation.hydrology.water.PondMask;
|
||||
import art.arcane.iris.generation.hydrology.water.Reach;
|
||||
import art.arcane.iris.generation.hydrology.water.ReachStyle;
|
||||
import art.arcane.iris.world.history.ChunkGenerationSemantics;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -193,36 +193,20 @@ final class WaterMap {
|
||||
for (Pond lake : plans.lakes()) {
|
||||
drawMask(lake.mask(), HydrologyFeatureType.LAKE);
|
||||
}
|
||||
for (SeaInlet inlet : plans.inlets()) {
|
||||
checkCancelled();
|
||||
drawInlet(inlet);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawInlet(SeaInlet inlet) {
|
||||
float[] xs = inlet.xs();
|
||||
float[] zs = inlet.zs();
|
||||
float[] halfWidth = inlet.halfWidth();
|
||||
for (int station = 0; station + 1 < xs.length; station++) {
|
||||
double radius = Math.max(halfWidth[station], halfWidth[station + 1]) + step / 2D;
|
||||
drawSegment(xs[station], zs[station], xs[station + 1], zs[station + 1], radius, HydrologyFeatureType.SEA_INLET);
|
||||
}
|
||||
drawSegment(inlet.chamberX(), inlet.chamberZ(), inlet.chamberX(), inlet.chamberZ(), inlet.chamberRadius() + step / 2D,
|
||||
HydrologyFeatureType.SEA_INLET);
|
||||
}
|
||||
|
||||
private void drawReach(Reach reach) {
|
||||
float[] xs = reach.xs();
|
||||
float[] zs = reach.zs();
|
||||
float[] halfWidth = reach.halfWidth();
|
||||
HydrologyFeatureType channel = channel(reach.tier());
|
||||
HydrologyFeatureType channel = reach.style()[0] == ReachStyle.TIDAL ? HydrologyFeatureType.SEA_INLET : channel(reach.tier());
|
||||
for (int point = 0; point < xs.length; point++) {
|
||||
int next = Math.min(point + 1, xs.length - 1);
|
||||
HydrologyFeatureType type = switch (reach.style()[point]) {
|
||||
case CASCADE -> HydrologyFeatureType.CASCADE;
|
||||
case WATERFALL -> HydrologyFeatureType.WATERFALL;
|
||||
case MOUTH -> HydrologyFeatureType.MOUTH;
|
||||
case RUN, RIFFLE, POND_OUTLET -> channel;
|
||||
case RUN, RIFFLE, POND_OUTLET, TIDAL -> channel;
|
||||
};
|
||||
double radius = Math.max(halfWidth[point], halfWidth[next]) + step / 2D;
|
||||
drawSegment(xs[point], zs[point], xs[next], zs[next], radius, type);
|
||||
|
||||
@@ -18,8 +18,6 @@ import art.arcane.iris.generation.hydrology.engine.HydrologyRuntime;
|
||||
import art.arcane.iris.generation.hydrology.query.HydrologyFeatureType;
|
||||
import art.arcane.iris.generation.hydrology.raster.ChunkWaterRaster;
|
||||
import art.arcane.iris.generation.hydrology.raster.WaterRole;
|
||||
import art.arcane.iris.generation.hydrology.underground.SeaInlet;
|
||||
import art.arcane.iris.generation.hydrology.underground.SeaInletRasterizer;
|
||||
import art.arcane.iris.generation.hydrology.water.HydrologyTier;
|
||||
import art.arcane.iris.generation.biome.IrisBiome;
|
||||
import art.arcane.iris.generation.terrain.IrisRegion;
|
||||
@@ -46,6 +44,7 @@ import java.util.Set;
|
||||
public final class GenerationSemanticCapture {
|
||||
private static final int CHUNK_SIZE = 16;
|
||||
private static final String INLET_PROFILE = HydrologyFeatureType.SEA_INLET.key();
|
||||
private static final Set<HydrologyFeatureType> INLET_TYPES = Set.of(HydrologyFeatureType.SEA_INLET);
|
||||
private static final long CAVE_POOL_SALT = 0x43415645504f4f4cL;
|
||||
|
||||
private GenerationSemanticCapture() {
|
||||
@@ -160,7 +159,6 @@ public final class GenerationSemanticCapture {
|
||||
int minimumX = Math.multiplyExact(chunkX, CHUNK_SIZE);
|
||||
int minimumZ = Math.multiplyExact(chunkZ, CHUNK_SIZE);
|
||||
int minimumY = engine.getDimension().getMinHeight();
|
||||
captureInlets(complex, runtime.inlets(chunkX, chunkZ), minimumX, minimumZ, minimumY, semantics);
|
||||
if (raster.empty()) {
|
||||
return;
|
||||
}
|
||||
@@ -175,14 +173,16 @@ public final class GenerationSemanticCapture {
|
||||
continue;
|
||||
}
|
||||
WaterRole role = complex.getWaterRoleStream().get(blockX, blockZ);
|
||||
if (!role.wet() || role == WaterRole.INLET) {
|
||||
if (!role.wet()) {
|
||||
continue;
|
||||
}
|
||||
long id = raster.featureId(localX, localZ);
|
||||
Set<HydrologyFeatureType> types = role == WaterRole.POND
|
||||
? standing.computeIfAbsent(id, feature -> runtime.standingWaterTypes(chunkX, chunkZ, feature))
|
||||
: flowingTypes(runtime, role, raster.tier(localX, localZ));
|
||||
String fluid = role == WaterRole.MOUTH
|
||||
Set<HydrologyFeatureType> types = switch (role) {
|
||||
case POND -> standing.computeIfAbsent(id, feature -> runtime.standingWaterTypes(chunkX, chunkZ, feature));
|
||||
case INLET -> INLET_TYPES;
|
||||
default -> flowingTypes(runtime, role, raster.tier(localX, localZ));
|
||||
};
|
||||
String fluid = role == WaterRole.INLET ? INLET_PROFILE : role == WaterRole.MOUTH
|
||||
? reachFluids.computeIfAbsent(id, reach -> runtime.channelFluid(chunkX, chunkZ, reach))
|
||||
: Objects.requireNonNull(raster.fluid(localX, localZ), "Water column " + blockX + "," + blockZ + " has no fluid profile");
|
||||
int y = Math.addExact((int) Math.round(complex.getWaterHeadStream().getDouble(blockX, blockZ)), minimumY);
|
||||
@@ -195,29 +195,6 @@ public final class GenerationSemanticCapture {
|
||||
}
|
||||
}
|
||||
|
||||
private static void captureInlets(IrisComplex complex, List<SeaInlet> inlets, int minimumX, int minimumZ, int minimumY,
|
||||
ChunkGenerationSemantics.Builder semantics) {
|
||||
for (SeaInlet inlet : inlets) {
|
||||
captureInlet(complex, inlet, minimumX, minimumZ, minimumY, semantics);
|
||||
}
|
||||
}
|
||||
|
||||
private static void captureInlet(IrisComplex complex, SeaInlet inlet, int minimumX, int minimumZ, int minimumY,
|
||||
ChunkGenerationSemantics.Builder semantics) {
|
||||
int[] column = new int[2];
|
||||
for (int localX = 0; localX < CHUNK_SIZE; localX++) {
|
||||
for (int localZ = 0; localZ < CHUNK_SIZE; localZ++) {
|
||||
int blockX = minimumX + localX;
|
||||
int blockZ = minimumZ + localZ;
|
||||
if (SeaInletRasterizer.column(inlet, blockX, blockZ, column) && hasFullHydrologyWeight(complex, blockX, blockZ)) {
|
||||
semantics.addRiverFeature(INLET_PROFILE, HydrologyFeatureType.SEA_INLET, inlet.id(), blockX,
|
||||
Math.addExact(inlet.waterLevel(), minimumY), blockZ);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Set<HydrologyFeatureType> flowingTypes(HydrologyRuntime runtime, WaterRole role, HydrologyTier tier) {
|
||||
return switch (role) {
|
||||
case CHANNEL -> Set.of(runtime.channelType(tier));
|
||||
|
||||
Reference in new issue
Block a user