mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-30 01:34:04 +00:00
Probe gates know estuaries
- missingSurface lets mouth columns take the biome sea layers like inlet columns, as the terrain stage paints them - missingSurface accepts the biome's own decoration at the head of mouth and inlet columns, which are decorated like the sea they join - missingSurface expects each column's effective fluid, so seam columns expect their seam - risingWaterSegments compares reach heads with the pond's snapped head instead of its raw level - bermOverCap spares the containment wall of pond outlet water held at its pond's head, the accepted perched flume
This commit is contained in:
1 parent
2ed13f9b7f
commit
ecbd177360
5 files changed
+163
-16
No files matched your search
@@ -33,6 +33,7 @@ final class HydrologyPlanMetrics {
|
||||
private final Map<WindowKey, Long> seams = new HashMap<>();
|
||||
private final Map<Long, Pond> endPonds = new HashMap<>();
|
||||
private final Map<Long, Set<Long>> pondReaches = new HashMap<>();
|
||||
private final Map<Long, Pond> outletPonds = new HashMap<>();
|
||||
private final Map<WindowKey, Integer> rivers;
|
||||
private final VertexIndex vertices;
|
||||
|
||||
@@ -53,6 +54,9 @@ final class HydrologyPlanMetrics {
|
||||
}
|
||||
}
|
||||
for (Pond pond : entry.getValue().ponds()) {
|
||||
if (pond.outletReachId() != 0L) {
|
||||
outletPonds.putIfAbsent(pond.outletReachId(), pond);
|
||||
}
|
||||
WindowKey owner = pondOwners.putIfAbsent(pond.id(), key);
|
||||
if (owner != null) {
|
||||
seam(key, "pond " + pond.id() + " owned by " + owner + " and " + key);
|
||||
@@ -74,6 +78,10 @@ final class HydrologyPlanMetrics {
|
||||
return endPonds.get(reach.id());
|
||||
}
|
||||
|
||||
Pond outletPond(long reachId) {
|
||||
return outletPonds.get(reachId);
|
||||
}
|
||||
|
||||
long seams(WindowKey key) {
|
||||
return seams.getOrDefault(key, 0L);
|
||||
}
|
||||
|
||||
@@ -4,8 +4,10 @@ import art.arcane.iris.generation.hydrology.plan.HydrologySettings;
|
||||
import art.arcane.iris.generation.hydrology.plan.WindowKey;
|
||||
import art.arcane.iris.generation.hydrology.plan.WindowPlan;
|
||||
import art.arcane.iris.generation.hydrology.raster.ChunkWaterRaster;
|
||||
import art.arcane.iris.generation.hydrology.raster.WaterHeads;
|
||||
import art.arcane.iris.generation.hydrology.raster.WaterRole;
|
||||
import art.arcane.iris.generation.hydrology.water.Pond;
|
||||
import art.arcane.iris.generation.hydrology.water.PondKind;
|
||||
import art.arcane.iris.generation.hydrology.water.Reach;
|
||||
import art.arcane.iris.generation.hydrology.water.ReachStyle;
|
||||
import art.arcane.iris.generation.hydrology.raster.NaturalHeights;
|
||||
@@ -13,6 +15,8 @@ import art.arcane.iris.generation.hydrology.raster.NaturalHeights;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
final class HydrologyRasterMetrics {
|
||||
private static final int[][] SIDES = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
|
||||
|
||||
private final HydrologySettings settings;
|
||||
private final HydrologyPlanMetrics plans;
|
||||
private final Rasters rasters;
|
||||
@@ -67,18 +71,18 @@ final class HydrologyRasterMetrics {
|
||||
}
|
||||
}
|
||||
Pond end = plans.endPond(reach);
|
||||
if (end != null && end.level() > previous) {
|
||||
if (end != null && head(end) > previous) {
|
||||
rising++;
|
||||
examples.accept("rise from reach " + reach.id() + " at " + previous + " into pond " + end.id() + " at " + end.level());
|
||||
examples.accept("rise from reach " + reach.id() + " at " + previous + " into pond " + end.id() + " at " + head(end));
|
||||
}
|
||||
}
|
||||
for (Pond pond : plan.ponds()) {
|
||||
Reach outlet = plans.reaches().get(pond.outletReachId());
|
||||
if (outlet != null) {
|
||||
int first = first(heads(outlet));
|
||||
if (first != HydrologyVoxels.NO_WATER && first > pond.level()) {
|
||||
if (first != HydrologyVoxels.NO_WATER && first > head(pond)) {
|
||||
rising++;
|
||||
examples.accept("rise from pond " + pond.id() + " at " + pond.level() + " into outlet " + outlet.id() + " at " + first);
|
||||
examples.accept("rise from pond " + pond.id() + " at " + head(pond) + " into outlet " + outlet.id() + " at " + first);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,7 +120,7 @@ final class HydrologyRasterMetrics {
|
||||
}
|
||||
int terrain = raster.terrainHeight(x & 15, z & 15);
|
||||
int natural = (int) Math.round(naturalHeight.height(x, z));
|
||||
if (terrain > natural + maxFill) {
|
||||
if (terrain > natural + maxFill && !heldOutletWall(x, z, terrain)) {
|
||||
overCap++;
|
||||
examples.accept("berm raised " + x + "," + z + " from " + natural + " to " + terrain);
|
||||
}
|
||||
@@ -125,6 +129,29 @@ final class HydrologyRasterMetrics {
|
||||
return overCap;
|
||||
}
|
||||
|
||||
private boolean heldOutletWall(int x, int z, int terrain) {
|
||||
for (int[] side : SIDES) {
|
||||
int nx = x + side[0];
|
||||
int nz = z + side[1];
|
||||
if (!range.containsBlock(nx, nz)) {
|
||||
continue;
|
||||
}
|
||||
ChunkWaterRaster raster = rasters.get(nx >> 4, nz >> 4);
|
||||
if (!raster.role(nx & 15, nz & 15).wet() || raster.waterHead(nx & 15, nz & 15) != terrain) {
|
||||
continue;
|
||||
}
|
||||
Pond pond = plans.outletPond(raster.featureId(nx & 15, nz & 15));
|
||||
if (pond != null && pond.kind() != PondKind.LAKE && head(pond) == terrain) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private int head(Pond pond) {
|
||||
return WaterHeads.snap(pond.level(), settings.seaLevel());
|
||||
}
|
||||
|
||||
WaterRole role(int x, int z) {
|
||||
return rasters.get(x >> 4, z >> 4).role(x & 15, z & 15);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package art.arcane.iris.probe;
|
||||
|
||||
import art.arcane.iris.generation.biome.IrisBiome;
|
||||
import art.arcane.iris.generation.decoration.IrisDecorator;
|
||||
import art.arcane.iris.generation.hydrology.engine.HydrologyRuntime;
|
||||
import art.arcane.iris.generation.hydrology.raster.ChunkWaterRaster;
|
||||
import art.arcane.iris.generation.hydrology.raster.WaterRole;
|
||||
import art.arcane.iris.generation.runtime.Engine;
|
||||
import art.arcane.iris.generation.runtime.IrisComplex;
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.volmlib.util.mantle.runtime.MantleChunk;
|
||||
import art.arcane.volmlib.util.matter.Matter;
|
||||
@@ -112,8 +115,13 @@ final class HydrologyVoxels {
|
||||
}
|
||||
int x = (chunkX << 4) + lx;
|
||||
int z = (chunkZ << 4) + lz;
|
||||
blocks.surfaces()[(lz << 4) | lx] = covered(complex, own, mantle, lx, head, lz, x, z) ? SOLID
|
||||
: classify(complex.resolveWaterFluid(own.fluid(lx, lz), x, z));
|
||||
WaterRole role = own.role(lx, lz);
|
||||
NativeBlockState object = mantle.get(lx, head, lz, NativeBlockState.class);
|
||||
IrisBiome biome = seaFloor(role) ? complex.getTrueBiomeStream().get(x, z) : null;
|
||||
boolean seaLayers = biome != null && biome.getSeaLayers().isNotEmpty();
|
||||
boolean seaDecoration = biome != null && decoratedBy(biome, chunk.blocks().get(lx, head, lz), engine.getData());
|
||||
blocks.surfaces()[(lz << 4) | lx] = plannedSurface(role, object != null && object.isSolid(), seaLayers, seaDecoration,
|
||||
classify(complex.resolveWaterFluid(x, z)));
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
@@ -122,14 +130,39 @@ final class HydrologyVoxels {
|
||||
return blocks;
|
||||
}
|
||||
|
||||
private static boolean covered(IrisComplex complex, ChunkWaterRaster raster, MantleChunk<Matter> mantle, int lx, int head, int lz, int x,
|
||||
int z) {
|
||||
NativeBlockState object = mantle.get(lx, head, lz, NativeBlockState.class);
|
||||
if (object != null && object.isSolid()) {
|
||||
return true;
|
||||
static byte plannedSurface(WaterRole role, boolean solidObject, boolean seaLayers, boolean seaDecoration, byte fluid) {
|
||||
return solidObject || seaFloor(role) && (seaLayers || seaDecoration) ? SOLID : fluid;
|
||||
}
|
||||
|
||||
static boolean decoratedBy(IrisBiome biome, NativeBlockState state, IrisData data) {
|
||||
if (state == null || state.isAir() || state.key() == null) {
|
||||
return false;
|
||||
}
|
||||
return raster.role(lx, lz) == WaterRole.INLET
|
||||
&& complex.getTrueBiomeStream().get(x, z).getSeaLayers().isNotEmpty();
|
||||
String block = blockId(state.key());
|
||||
for (IrisDecorator decorator : biome.getDecorators()) {
|
||||
if (places(decorator.getBlockData(data), block) || places(decorator.getBlockDataTops(data), block)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean seaFloor(WaterRole role) {
|
||||
return role == WaterRole.INLET || role == WaterRole.MOUTH;
|
||||
}
|
||||
|
||||
private static boolean places(List<NativeBlockState> palette, String block) {
|
||||
for (NativeBlockState state : palette) {
|
||||
if (state != null && state.key() != null && blockId(state.key()).equals(block)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static String blockId(String key) {
|
||||
int bracket = key.indexOf('[');
|
||||
return bracket < 0 ? key : key.substring(0, bracket);
|
||||
}
|
||||
|
||||
static int[] effectiveHeads(IrisComplex complex, int chunkX, int chunkZ) {
|
||||
@@ -287,8 +320,7 @@ final class HydrologyVoxels {
|
||||
|
||||
private static byte resolve(NativeBlockState state) {
|
||||
String key = state.key();
|
||||
int bracket = key.indexOf('[');
|
||||
String block = bracket < 0 ? key : key.substring(0, bracket);
|
||||
String block = blockId(key);
|
||||
if (block.equals("minecraft:water")) {
|
||||
return (byte) (WATER + level(key));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user