mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-29 01:04:29 +00:00
Veto springs near structures
- Drop a spring when an imported structure piece lies within 32 blocks, from world minimum to one block above the seep - Pass the seep position to the carved terrain structure check - Clear the block update when a pool wall replaces a spring - Pin the spring guards with behaviour tests across several seeds - Pin startsNear reach and the springs-only component and runtime gates
This commit is contained in:
11 files changed
+335
-26
No files matched your search
+1
-1
@@ -7,5 +7,5 @@ public interface CarvedTerrain {
|
||||
|
||||
String caveFluid(int x, int y, int z);
|
||||
|
||||
boolean structureNear();
|
||||
boolean structureNear(int x, int y, int z);
|
||||
}
|
||||
+6
-1
@@ -5,6 +5,7 @@ import art.arcane.iris.generation.hydrology.cave.HydrologyCaveCell;
|
||||
import art.arcane.iris.generation.hydrology.grid.CellHash;
|
||||
import art.arcane.iris.generation.hydrology.plan.HydrologySettings;
|
||||
import art.arcane.iris.generation.mantle.MantleWriter;
|
||||
import art.arcane.volmlib.util.matter.slices.UpdateMatter;
|
||||
import it.unimi.dsi.fastutil.longs.LongArrayFIFOQueue;
|
||||
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
|
||||
|
||||
@@ -174,9 +175,13 @@ public final class CavePoolFiller {
|
||||
}
|
||||
int y = unpackY(cell);
|
||||
HydrologyCaveCell existing = writer.getDataIfPresent(x, y, z, HydrologyCaveCell.class);
|
||||
if (existing == null || existing.action() == HydrologyCaveAction.SPRING_SOURCE || replacesSharedWall(existing, value)) {
|
||||
boolean spring = existing != null && existing.action() == HydrologyCaveAction.SPRING_SOURCE;
|
||||
if (existing == null || spring || replacesSharedWall(existing, value)) {
|
||||
writer.setData(x, y, z, value);
|
||||
}
|
||||
if (spring) {
|
||||
writer.setData(x, y, z, UpdateMatter.OFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ public final class CaveSpringPlacer {
|
||||
int x = (chunkX << 4) + (int) (column & 15);
|
||||
int z = (chunkZ << 4) + (int) ((column >>> 4) & 15);
|
||||
int y = seep(carved, x, z, seed);
|
||||
if (y >= 0 && contained(carved, x, y, z) && !carved.structureNear()) {
|
||||
if (y >= 0 && contained(carved, x, y, z) && !carved.structureNear(x, y, z)) {
|
||||
write(chunkX, chunkZ, x, y, z, new HydrologyCaveCell(HydrologyCaveAction.SPRING_SOURCE, fluid(carved, x, y, z)), writer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import art.arcane.iris.generation.terrain.IrisDimension;
|
||||
import art.arcane.iris.generation.terrain.IrisRegion;
|
||||
import art.arcane.iris.generation.terrain.Terrain3DColumn;
|
||||
import art.arcane.iris.structure.placement.StructurePlacementScope;
|
||||
import art.arcane.volmlib.nativelib.terrain.structure.NativeStructureVolume;
|
||||
import art.arcane.volmlib.util.mantle.flag.MantleFlag;
|
||||
import art.arcane.volmlib.util.mantle.runtime.MantleChunk;
|
||||
import art.arcane.volmlib.util.matter.Matter;
|
||||
@@ -31,6 +32,7 @@ final class MantleCarvedTerrain implements CarvedTerrain {
|
||||
private static final int SPAN = 48;
|
||||
private static final int UNKNOWN = Integer.MIN_VALUE;
|
||||
private static final int STRUCTURE_REACH_CHUNKS = 8;
|
||||
private static final int IMPORTED_STRUCTURE_REACH = 32;
|
||||
|
||||
private final MantleWriter writer;
|
||||
private final IrisComplex complex;
|
||||
@@ -123,13 +125,27 @@ final class MantleCarvedTerrain implements CarvedTerrain {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean structureNear() {
|
||||
public boolean structureNear(int x, int y, int z) {
|
||||
long revision = ProvisionalSampling.revision();
|
||||
boolean near = StructurePlacementScope.startsNear(engine, chunkX, chunkZ, STRUCTURE_REACH_CHUNKS);
|
||||
boolean near = importedStructureNear(x, y, z) || StructurePlacementScope.startsNear(engine, chunkX, chunkZ, STRUCTURE_REACH_CHUNKS);
|
||||
requireFinal(revision, chunkX << 4, chunkZ << 4);
|
||||
return near;
|
||||
}
|
||||
|
||||
private boolean importedStructureNear(int x, int y, int z) {
|
||||
int minX = x - IMPORTED_STRUCTURE_REACH;
|
||||
int minZ = z - IMPORTED_STRUCTURE_REACH;
|
||||
int maxX = x + IMPORTED_STRUCTURE_REACH;
|
||||
int maxZ = z + IMPORTED_STRUCTURE_REACH;
|
||||
int maxY = y + minimumY + 1;
|
||||
for (NativeStructureVolume volume : engine.getNativeStructureVolumes(minX, minZ, maxX, maxZ)) {
|
||||
if (volume.intersects(minX, minimumY, minZ, maxX, maxY, maxZ)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static Collection<SeaInlet> inlets(HydrologyRuntime runtime, int chunkX, int chunkZ) {
|
||||
Map<Long, SeaInlet> inlets = new LinkedHashMap<>();
|
||||
for (int offsetZ = -1; offsetZ <= 1; offsetZ++) {
|
||||
|
||||
Reference in new issue
Block a user