mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-30 09:44:24 +00:00
Delete grotto remnants
- Remove SealedPassage, PassageRasterizer, PassageSpace and HydrologyRuntime.passages - Remove the passage loop, passage space and headroom plumbing from mantle and carve - Keep WET_SOURCE and DRY_AIR readable for mantle data already written
This commit is contained in:
18 files changed
+10
-1262
No files matched your search
@@ -19,7 +19,6 @@ import art.arcane.iris.generation.hydrology.raster.ChannelFluids;
|
||||
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.SealedPassage;
|
||||
import art.arcane.iris.generation.hydrology.water.HydrologyTier;
|
||||
import art.arcane.iris.generation.hydrology.water.Pond;
|
||||
import art.arcane.iris.generation.hydrology.water.Reach;
|
||||
@@ -438,10 +437,6 @@ public final class HydrologyRuntime {
|
||||
return HydrologyFeatureSearch.channelType(settings, tier);
|
||||
}
|
||||
|
||||
public List<SealedPassage> passages(int chunkX, int chunkZ) {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
public Set<HydrologyFeatureType> standingWaterTypes(int chunkX, int chunkZ, long featureId) {
|
||||
if (cache == null) {
|
||||
throw new IllegalStateException("Hydrology is disabled, so it has no standing water.");
|
||||
|
||||
-169
@@ -1,169 +0,0 @@
|
||||
package art.arcane.iris.generation.hydrology.underground;
|
||||
|
||||
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveAction;
|
||||
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveCell;
|
||||
import art.arcane.iris.generation.mantle.MantleWriter;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public final class PassageRasterizer {
|
||||
public static final int SHELL = 2;
|
||||
private static final int CHUNK = 16;
|
||||
private static final int GRID = CHUNK + 2 * SHELL;
|
||||
static final int NONE = Integer.MIN_VALUE;
|
||||
|
||||
public void write(SealedPassage passage, int chunkX, int chunkZ, MantleWriter writer, String fluid, SubterrainFluid subterrain,
|
||||
HistoricalChunks historical) {
|
||||
if (!touches(passage, chunkX, chunkZ)) {
|
||||
return;
|
||||
}
|
||||
int[] floors = new int[GRID * GRID];
|
||||
int[] ceilings = new int[GRID * GRID];
|
||||
if (!shape(passage, (chunkX << 4) - SHELL, (chunkZ << 4) - SHELL, GRID, floors, ceilings)) {
|
||||
return;
|
||||
}
|
||||
HydrologyCaveCell wet = new HydrologyCaveCell(HydrologyCaveAction.WET_SOURCE, fluid);
|
||||
HydrologyCaveCell dry = new HydrologyCaveCell(HydrologyCaveAction.DRY_AIR, fluid);
|
||||
HydrologyCaveCell guard = new HydrologyCaveCell(HydrologyCaveAction.SEAL_GUARD, fluid);
|
||||
int water = passage.waterLevel();
|
||||
boolean[] historicalAround = historicalAround(chunkX, chunkZ, historical);
|
||||
for (int lz = 0; lz < CHUNK; lz++) {
|
||||
for (int lx = 0; lx < CHUNK; lx++) {
|
||||
int cell = (lz + SHELL) * GRID + lx + SHELL;
|
||||
int x = (chunkX << 4) + lx;
|
||||
int z = (chunkZ << 4) + lz;
|
||||
int low = nearby(floors, GRID, cell, true);
|
||||
if (low == NONE) {
|
||||
continue;
|
||||
}
|
||||
int floor = floors[cell];
|
||||
if (floor == NONE) {
|
||||
guard(writer, x, low - SHELL, water, z, guard);
|
||||
} else if (historicalAround != null && besideHistorical(historicalAround, lx, lz)) {
|
||||
guard(writer, x, low - SHELL, ceilings[cell], z, guard);
|
||||
} else {
|
||||
for (int y = floor + 1; y <= water; y++) {
|
||||
writer.setData(x, y, z, wet);
|
||||
writer.clearData(x, y, z, NativeBlockState.class);
|
||||
}
|
||||
for (int y = water + 1; y <= ceilings[cell]; y++) {
|
||||
writer.setData(x, y, z, dry);
|
||||
}
|
||||
guard(writer, x, low - SHELL, floor, z, guard);
|
||||
}
|
||||
int roof = nearbyRoof(ceilings, cell, water);
|
||||
for (int y = water + 1; y <= roof + SHELL; y++) {
|
||||
if (subterrain.at(x, y, z)) {
|
||||
guard(writer, x, y, y, z, guard);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface SubterrainFluid {
|
||||
SubterrainFluid NOWHERE = (x, y, z) -> false;
|
||||
|
||||
boolean at(int x, int y, int z);
|
||||
}
|
||||
|
||||
public interface HistoricalChunks {
|
||||
HistoricalChunks NONE = (chunkX, chunkZ) -> false;
|
||||
|
||||
boolean at(int chunkX, int chunkZ);
|
||||
}
|
||||
|
||||
public static boolean touches(SealedPassage passage, int chunkX, int chunkZ) {
|
||||
int[] bounds = passage.bounds();
|
||||
int minX = chunkX << 4;
|
||||
int minZ = chunkZ << 4;
|
||||
return bounds[0] <= minX + CHUNK - 1 + SHELL && bounds[2] >= minX - SHELL && bounds[1] <= minZ + CHUNK - 1 + SHELL
|
||||
&& bounds[3] >= minZ - SHELL;
|
||||
}
|
||||
|
||||
static boolean shape(SealedPassage passage, int originX, int originZ, int size, int[] floors, int[] ceilings) {
|
||||
Arrays.fill(floors, NONE);
|
||||
Arrays.fill(ceilings, NONE);
|
||||
boolean any = false;
|
||||
int[] column = new int[2];
|
||||
for (int gz = 0; gz < size; gz++) {
|
||||
for (int gx = 0; gx < size; gx++) {
|
||||
if (passage.column(originX + gx, originZ + gz, column)) {
|
||||
floors[gz * size + gx] = column[0];
|
||||
ceilings[gz * size + gx] = column[1];
|
||||
any = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return any;
|
||||
}
|
||||
|
||||
static int nearby(int[] values, int size, int cell, boolean lowest) {
|
||||
int found = NONE;
|
||||
int gx = cell % size;
|
||||
int gz = cell / size;
|
||||
for (int dz = -SHELL; dz <= SHELL; dz++) {
|
||||
for (int dx = -SHELL; dx <= SHELL; dx++) {
|
||||
int value = values[(gz + dz) * size + gx + dx];
|
||||
if (value != NONE && (found == NONE || (lowest ? value < found : value > found))) {
|
||||
found = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
private static int nearbyRoof(int[] ceilings, int cell, int water) {
|
||||
int roof = water - SHELL;
|
||||
int gx = cell % GRID;
|
||||
int gz = cell / GRID;
|
||||
for (int dz = -SHELL; dz <= SHELL; dz++) {
|
||||
for (int dx = -SHELL; dx <= SHELL; dx++) {
|
||||
int ceiling = ceilings[(gz + dz) * GRID + gx + dx];
|
||||
if (ceiling > water && ceiling > roof) {
|
||||
roof = ceiling;
|
||||
}
|
||||
}
|
||||
}
|
||||
return roof;
|
||||
}
|
||||
|
||||
private static boolean[] historicalAround(int chunkX, int chunkZ, HistoricalChunks historical) {
|
||||
boolean[] around = null;
|
||||
for (int dz = -1; dz <= 1; dz++) {
|
||||
for (int dx = -1; dx <= 1; dx++) {
|
||||
if ((dx != 0 || dz != 0) && historical.at(chunkX + dx, chunkZ + dz)) {
|
||||
if (around == null) {
|
||||
around = new boolean[9];
|
||||
}
|
||||
around[(dz + 1) * 3 + dx + 1] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return around;
|
||||
}
|
||||
|
||||
private static boolean besideHistorical(boolean[] historicalAround, int lx, int lz) {
|
||||
int fromX = lx < SHELL ? -1 : 0;
|
||||
int toX = lx >= CHUNK - SHELL ? 1 : 0;
|
||||
int fromZ = lz < SHELL ? -1 : 0;
|
||||
int toZ = lz >= CHUNK - SHELL ? 1 : 0;
|
||||
for (int dz = fromZ; dz <= toZ; dz++) {
|
||||
for (int dx = fromX; dx <= toX; dx++) {
|
||||
if (historicalAround[(dz + 1) * 3 + dx + 1]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void guard(MantleWriter writer, int x, int fromY, int toY, int z, HydrologyCaveCell guard) {
|
||||
for (int y = fromY; y <= toY; y++) {
|
||||
if (writer.getDataIfPresent(x, y, z, HydrologyCaveCell.class) == null) {
|
||||
writer.setData(x, y, z, guard);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package art.arcane.iris.generation.hydrology.underground;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
public final class PassageSpace {
|
||||
private static final int SHELL = PassageRasterizer.SHELL;
|
||||
private static final int NONE = PassageRasterizer.NONE;
|
||||
|
||||
private final int originX;
|
||||
private final int originZ;
|
||||
private final int size;
|
||||
private final int[] lows;
|
||||
private final int[] highs;
|
||||
|
||||
private PassageSpace(int originX, int originZ, int size, int[] lows, int[] highs) {
|
||||
this.originX = originX;
|
||||
this.originZ = originZ;
|
||||
this.size = size;
|
||||
this.lows = lows;
|
||||
this.highs = highs;
|
||||
}
|
||||
|
||||
public static PassageSpace of(Collection<SealedPassage> passages, int originX, int originZ, int size) {
|
||||
int[] lows = new int[size * size];
|
||||
int[] highs = new int[size * size];
|
||||
Arrays.fill(lows, NONE);
|
||||
Arrays.fill(highs, NONE);
|
||||
int grid = size + 2 * SHELL;
|
||||
int[] floors = new int[grid * grid];
|
||||
int[] ceilings = new int[grid * grid];
|
||||
for (SealedPassage passage : passages) {
|
||||
if (!PassageRasterizer.shape(passage, originX - SHELL, originZ - SHELL, grid, floors, ceilings)) {
|
||||
continue;
|
||||
}
|
||||
for (int z = 0; z < size; z++) {
|
||||
for (int x = 0; x < size; x++) {
|
||||
int cell = (z + SHELL) * grid + x + SHELL;
|
||||
int low = PassageRasterizer.nearby(floors, grid, cell, true);
|
||||
if (low == NONE) {
|
||||
continue;
|
||||
}
|
||||
int column = z * size + x;
|
||||
int bottom = low - SHELL;
|
||||
int top = Math.max(passage.waterLevel(), PassageRasterizer.nearby(ceilings, grid, cell, false));
|
||||
lows[column] = lows[column] == NONE ? bottom : Math.min(lows[column], bottom);
|
||||
highs[column] = Math.max(highs[column], top);
|
||||
}
|
||||
}
|
||||
}
|
||||
return new PassageSpace(originX, originZ, size, lows, highs);
|
||||
}
|
||||
|
||||
public boolean contains(int x, int y, int z) {
|
||||
int localX = x - originX;
|
||||
int localZ = z - originZ;
|
||||
if (localX < 0 || localX >= size || localZ < 0 || localZ >= size) {
|
||||
return false;
|
||||
}
|
||||
int column = localZ * size + localX;
|
||||
return lows[column] != NONE && y >= lows[column] && y <= highs[column];
|
||||
}
|
||||
}
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
package art.arcane.iris.generation.hydrology.underground;
|
||||
|
||||
public interface SealedPassage {
|
||||
long id();
|
||||
|
||||
int waterLevel();
|
||||
|
||||
int roofClearance();
|
||||
|
||||
int[] bounds();
|
||||
|
||||
boolean column(int x, int z, int[] out);
|
||||
}
|
||||
@@ -1,12 +1,8 @@
|
||||
package art.arcane.iris.generation.mantle;
|
||||
|
||||
import art.arcane.iris.generation.hydrology.engine.HydrologyRuntime;
|
||||
import art.arcane.iris.generation.hydrology.raster.ChunkWaterRaster;
|
||||
import art.arcane.iris.generation.hydrology.underground.SealedPassage;
|
||||
import art.arcane.volmlib.util.math.PowerOfTwoCoordinates;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public final class CaveCeilingMask {
|
||||
static final int CONTAINMENT = 2;
|
||||
@@ -58,68 +54,6 @@ public final class CaveCeilingMask {
|
||||
return masked;
|
||||
}
|
||||
|
||||
public static long[] headroom(int chunkX, int chunkZ, HydrologyRuntime runtime, long[] bands) {
|
||||
List<SealedPassage> passages = runtime.passages(chunkX, chunkZ);
|
||||
if (passages.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return fillHeadroom(chunkX, chunkZ, passages, bands) ? bands : null;
|
||||
}
|
||||
|
||||
static boolean fillHeadroom(int chunkX, int chunkZ, List<SealedPassage> passages, long[] bands) {
|
||||
if (passages.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
int originX = (chunkX << 4) - CONTAINMENT;
|
||||
int originZ = (chunkZ << 4) - CONTAINMENT;
|
||||
int[] bottoms = new int[FIELD * FIELD];
|
||||
int[] tops = new int[FIELD * FIELD];
|
||||
Arrays.fill(bottoms, Integer.MAX_VALUE);
|
||||
Arrays.fill(tops, Integer.MIN_VALUE);
|
||||
int[] column = new int[2];
|
||||
boolean roofed = false;
|
||||
for (SealedPassage passage : passages) {
|
||||
int[] bounds = passage.bounds();
|
||||
int fromX = Math.max(originX, bounds[0]);
|
||||
int toX = Math.min(originX + FIELD - 1, bounds[2]);
|
||||
int toZ = Math.min(originZ + FIELD - 1, bounds[3]);
|
||||
for (int z = Math.max(originZ, bounds[1]); z <= toZ; z++) {
|
||||
for (int x = fromX; x <= toX; x++) {
|
||||
if (!passage.column(x, z, column)) {
|
||||
continue;
|
||||
}
|
||||
int index = (z - originZ) * FIELD + x - originX;
|
||||
bottoms[index] = Math.min(bottoms[index], passage.waterLevel() + 1);
|
||||
tops[index] = Math.max(tops[index], column[1] + passage.roofClearance());
|
||||
roofed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!roofed) {
|
||||
return false;
|
||||
}
|
||||
boolean masked = false;
|
||||
for (int lz = 0; lz < CHUNK; lz++) {
|
||||
for (int lx = 0; lx < CHUNK; lx++) {
|
||||
int bottom = Integer.MAX_VALUE;
|
||||
int top = Integer.MIN_VALUE;
|
||||
for (int fz = lz; fz <= lz + CONTAINMENT * 2; fz++) {
|
||||
for (int fx = lx; fx <= lx + CONTAINMENT * 2; fx++) {
|
||||
bottom = Math.min(bottom, bottoms[fz * FIELD + fx]);
|
||||
top = Math.max(top, tops[fz * FIELD + fx]);
|
||||
}
|
||||
}
|
||||
bands[PowerOfTwoCoordinates.packLocal16(lx, lz)] = SurfaceFluidBoundaryPlan.boundary(bottom, top);
|
||||
masked |= bottom <= top;
|
||||
}
|
||||
}
|
||||
return masked;
|
||||
}
|
||||
|
||||
public static boolean masked(int[] ceilings, long[] headroom, int column, int y) {
|
||||
return ceilings != null && y > ceilings[column] || SurfaceFluidBoundaryPlan.protects(headroom, column, y);
|
||||
}
|
||||
|
||||
public static ChunkWaterRaster ready(ChunkWaterRaster raster, int chunkX, int chunkZ) {
|
||||
if (raster.provisional()) {
|
||||
throw new IllegalStateException("The water raster for chunk " + chunkX + "," + chunkZ
|
||||
|
||||
@@ -5,8 +5,6 @@ import art.arcane.iris.generation.hydrology.config.IrisHydrologyPolicy;
|
||||
import art.arcane.iris.generation.hydrology.engine.HydrologyRuntime;
|
||||
import art.arcane.iris.generation.hydrology.underground.CarvedTerrain;
|
||||
import art.arcane.iris.generation.hydrology.underground.CaveVoxel;
|
||||
import art.arcane.iris.generation.hydrology.underground.PassageSpace;
|
||||
import art.arcane.iris.generation.hydrology.underground.SealedPassage;
|
||||
import art.arcane.iris.generation.runtime.Engine;
|
||||
import art.arcane.iris.generation.runtime.IrisComplex;
|
||||
import art.arcane.iris.generation.stream.ProvisionalSampling;
|
||||
@@ -23,10 +21,7 @@ import art.arcane.volmlib.util.matter.Matter;
|
||||
import art.arcane.volmlib.util.matter.MatterCavern;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
final class MantleCarvedTerrain implements CarvedTerrain {
|
||||
private static final int SPAN = 48;
|
||||
@@ -49,7 +44,6 @@ final class MantleCarvedTerrain implements CarvedTerrain {
|
||||
private final SubterrainPlanner planner;
|
||||
private final List<SubterrainPlan> features;
|
||||
private final boolean terrain3D;
|
||||
private final PassageSpace passages;
|
||||
private final MantleChunk<Matter>[] chunks;
|
||||
private final boolean[] existing;
|
||||
private final int[] surfaces = new int[SPAN * SPAN];
|
||||
@@ -71,7 +65,6 @@ final class MantleCarvedTerrain implements CarvedTerrain {
|
||||
this.minimumY = engine.getWorld().minHeight();
|
||||
HydrologyRuntime runtime = complex.getHydrologyRuntime();
|
||||
this.caveFluids = runtime.caveFluidPolicies();
|
||||
this.passages = PassageSpace.of(passages(runtime, chunkX, chunkZ), originX, originZ, SPAN);
|
||||
SubterrainPlanner subterrain = complex.getSubterrainPlanner();
|
||||
List<SubterrainPlan> plans = subterrain == null || subterrain.isEmpty() ? List.of()
|
||||
: subterrain.plansForBounds(originX, originZ, originX + SPAN - 1, originZ + SPAN - 1);
|
||||
@@ -88,7 +81,7 @@ final class MantleCarvedTerrain implements CarvedTerrain {
|
||||
@Override
|
||||
public CaveVoxel voxel(int x, int y, int z) {
|
||||
int column = column(x, z);
|
||||
if (y <= 0 || y >= height || existing(x, z) || y > surface(x, z, column) || passages.contains(x, y, z)) {
|
||||
if (y <= 0 || y >= height || existing(x, z) || y > surface(x, z, column)) {
|
||||
return CaveVoxel.FOREIGN;
|
||||
}
|
||||
if (planner != null && planner.sample(features, x, y + minimumY, z).owned()) {
|
||||
@@ -149,18 +142,6 @@ final class MantleCarvedTerrain implements CarvedTerrain {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static Collection<SealedPassage> passages(HydrologyRuntime runtime, int chunkX, int chunkZ) {
|
||||
Map<Long, SealedPassage> passages = new LinkedHashMap<>();
|
||||
for (int offsetZ = -1; offsetZ <= 1; offsetZ++) {
|
||||
for (int offsetX = -1; offsetX <= 1; offsetX++) {
|
||||
for (SealedPassage passage : runtime.passages(chunkX + offsetX, chunkZ + offsetZ)) {
|
||||
passages.putIfAbsent(passage.id(), passage);
|
||||
}
|
||||
}
|
||||
}
|
||||
return passages.values();
|
||||
}
|
||||
|
||||
private int surface(int x, int z, int column) {
|
||||
int known = surfaces[column];
|
||||
if (known == UNKNOWN) {
|
||||
|
||||
@@ -169,10 +169,6 @@ public class MantleCarvingComponent extends IrisMantleComponent {
|
||||
);
|
||||
int[] caveCeilings = CaveCeilingMask.fill(x, z, complex.getHydrologyRuntime()::raster,
|
||||
blendScratch.caveCeilingField, blendScratch.caveCeilings) ? blendScratch.caveCeilings : null;
|
||||
long[] passageHeadroom = CaveCeilingMask.headroom(x, z, complex.getHydrologyRuntime(), blendScratch.passageHeadroom);
|
||||
if (passageHeadroom != null) {
|
||||
SurfaceFluidBoundaryPlan.join(surfaceFluidBoundaries, passageHeadroom);
|
||||
}
|
||||
CaveFluidSupportPlan fluidSupportPlan = new CaveFluidSupportPlan();
|
||||
for (WeightedProfile weightedProfile : weightedProfiles) {
|
||||
carveProfile(weightedProfile, writer, x, z, chunkSurfaceHeights, surfaceFluidBoundaries, caveCeilings, fluidSupportPlan);
|
||||
@@ -194,10 +190,10 @@ public class MantleCarvingComponent extends IrisMantleComponent {
|
||||
caveCeilings
|
||||
);
|
||||
}
|
||||
rasterizeSubterrain(writer, x, z, complex, caveCeilings, passageHeadroom);
|
||||
rasterizeSubterrain(writer, x, z, complex, caveCeilings);
|
||||
}
|
||||
|
||||
private void rasterizeSubterrain(MantleWriter writer, int chunkX, int chunkZ, IrisComplex complex, int[] caveCeilings, long[] passageHeadroom) {
|
||||
private void rasterizeSubterrain(MantleWriter writer, int chunkX, int chunkZ, IrisComplex complex, int[] caveCeilings) {
|
||||
SubterrainPlanner planner = complex.getSubterrainPlanner();
|
||||
if (planner == null || planner.isEmpty()) {
|
||||
return;
|
||||
@@ -211,7 +207,7 @@ public class MantleCarvingComponent extends IrisMantleComponent {
|
||||
if (cell.solid() && !cell.room().reservedSolid()) {
|
||||
return;
|
||||
}
|
||||
if (!cell.solid() && CaveCeilingMask.masked(caveCeilings, passageHeadroom, PowerOfTwoCoordinates.packLocal16(x & 15, z & 15), y)) {
|
||||
if (!cell.solid() && caveCeilings != null && y > caveCeilings[PowerOfTwoCoordinates.packLocal16(x & 15, z & 15)]) {
|
||||
return;
|
||||
}
|
||||
if (cell.solid()) {
|
||||
@@ -767,7 +763,6 @@ public class MantleCarvingComponent extends IrisMantleComponent {
|
||||
private final double[] chunkSurfaceHeightSamples = new double[CHUNK_AREA];
|
||||
private final int[] caveCeilingField = new int[CaveCeilingMask.FIELD * CaveCeilingMask.FIELD];
|
||||
private final int[] caveCeilings = new int[CHUNK_AREA];
|
||||
private final long[] passageHeadroom = new long[CHUNK_AREA];
|
||||
private final double[][] neighbourHeights = new double[NEIGHBOURS][CHUNK_AREA];
|
||||
private final Object[][] neighbourObjects = new Object[NEIGHBOURS][CHUNK_AREA];
|
||||
private final long[][] neighbourSubmerged = new long[NEIGHBOURS][4];
|
||||
|
||||
@@ -12,8 +12,6 @@ import art.arcane.iris.generation.hydrology.raster.FluidSeams;
|
||||
import art.arcane.iris.generation.hydrology.underground.CarvedTerrain;
|
||||
import art.arcane.iris.generation.hydrology.underground.CavePoolFiller;
|
||||
import art.arcane.iris.generation.hydrology.underground.CaveSpringPlacer;
|
||||
import art.arcane.iris.generation.hydrology.underground.PassageRasterizer;
|
||||
import art.arcane.iris.generation.hydrology.underground.SealedPassage;
|
||||
import art.arcane.iris.generation.runtime.Engine;
|
||||
import art.arcane.iris.generation.runtime.IrisComplex;
|
||||
import art.arcane.iris.generation.subterrain.SubterrainPlan;
|
||||
@@ -35,7 +33,6 @@ public final class MantleHydrologyComponent extends IrisMantleComponent {
|
||||
private static final int CHUNK = 16;
|
||||
private static final int GRID = CHUNK + 2;
|
||||
private static final int[] SIDES = {1, -1, GRID, -GRID};
|
||||
private static final PassageRasterizer PASSAGES = new PassageRasterizer();
|
||||
|
||||
public MantleHydrologyComponent(EngineMantle engineMantle) {
|
||||
super(engineMantle, ReservedFlag.RIVER_HYDROLOGY, PRIORITY);
|
||||
@@ -84,13 +81,6 @@ public final class MantleHydrologyComponent extends IrisMantleComponent {
|
||||
}
|
||||
HydrologyRuntime runtime = complex.getHydrologyRuntime();
|
||||
ChunkWaterRaster own = CaveCeilingMask.ready(runtime.raster(chunkX, chunkZ), chunkX, chunkZ);
|
||||
List<SealedPassage> passages = runtime.passages(chunkX, chunkZ);
|
||||
if (!passages.isEmpty()) {
|
||||
PassageRasterizer.SubterrainFluid subterrain = subterrainFluid(writer, complex, chunkX, chunkZ);
|
||||
for (SealedPassage passage : passages) {
|
||||
PASSAGES.write(passage, chunkX, chunkZ, writer, HydrologyCaveCell.SEA_FLUID, subterrain, complex::isHistoricalChunk);
|
||||
}
|
||||
}
|
||||
generateFalls(writer, complex, runtime, own, chunkX, chunkZ);
|
||||
if (caveWaterActive()) {
|
||||
HydrologySettings settings = runtime.settings();
|
||||
@@ -107,19 +97,6 @@ public final class MantleHydrologyComponent extends IrisMantleComponent {
|
||||
}
|
||||
}
|
||||
|
||||
private static PassageRasterizer.SubterrainFluid subterrainFluid(MantleWriter writer, IrisComplex complex, int chunkX, int chunkZ) {
|
||||
SubterrainPlanner planner = complex.getSubterrainPlanner();
|
||||
if (planner == null || planner.isEmpty()) {
|
||||
return PassageRasterizer.SubterrainFluid.NOWHERE;
|
||||
}
|
||||
List<SubterrainPlan> plans = planner.plansForBounds(chunkX << 4, chunkZ << 4, (chunkX << 4) + 15, (chunkZ << 4) + 15);
|
||||
if (plans.isEmpty()) {
|
||||
return PassageRasterizer.SubterrainFluid.NOWHERE;
|
||||
}
|
||||
int minimumY = writer.getEngine().getWorld().minHeight();
|
||||
return (x, y, z) -> planner.sample(plans, x, y + minimumY, z).fluid();
|
||||
}
|
||||
|
||||
private void generateFalls(MantleWriter writer, IrisComplex complex, HydrologyRuntime runtime, ChunkWaterRaster own, int chunkX,
|
||||
int chunkZ) {
|
||||
if (!holdsWater(own)) {
|
||||
|
||||
@@ -73,17 +73,6 @@ final class SurfaceFluidBoundaryPlan {
|
||||
}
|
||||
}
|
||||
|
||||
static void join(long[] boundaries, long[] bands) {
|
||||
for (int columnIndex = 0; columnIndex < CHUNK_AREA; columnIndex++) {
|
||||
long band = bands[columnIndex];
|
||||
if (startY(band) > endY(band)) {
|
||||
continue;
|
||||
}
|
||||
long boundary = boundaries[columnIndex];
|
||||
boundaries[columnIndex] = boundary(Math.min(startY(boundary), startY(band)), Math.max(endY(boundary), endY(band)));
|
||||
}
|
||||
}
|
||||
|
||||
static boolean protects(long[] boundaries, int columnIndex, int y) {
|
||||
if (boundaries == null || columnIndex < 0 || columnIndex >= boundaries.length) {
|
||||
return false;
|
||||
|
||||
@@ -164,8 +164,7 @@ public class IrisCarveModifier extends EngineAssignedModifier<NativeBlockState>
|
||||
getEngine().getWorld().minHeight(),
|
||||
resolverState.complex,
|
||||
subterrainPlanner == null ? null : subterrainPlanner.chunkSampler(x, z),
|
||||
subterrain ? caveCeilings(resolverState.complex, x, z) : null,
|
||||
subterrain ? passageHeadroom(resolverState.complex, x, z) : null
|
||||
subterrain ? caveCeilings(resolverState.complex, x, z) : null
|
||||
);
|
||||
CarveResolver carveResolver = new CarveResolver(resolutionContext);
|
||||
terrain.forEachCell(carveResolver::apply);
|
||||
@@ -263,17 +262,16 @@ public class IrisCarveModifier extends EngineAssignedModifier<NativeBlockState>
|
||||
int minimumY = getEngine().getWorld().minHeight();
|
||||
SubterrainSurfaceMaterials materials = subterrainMaterials(planner, blockX >> 4, blockZ >> 4);
|
||||
int[] caveCeilings = caveCeilings(getComplex(), blockX >> 4, blockZ >> 4);
|
||||
long[] passageHeadroom = passageHeadroom(getComplex(), blockX >> 4, blockZ >> 4);
|
||||
MantleChunk<Matter> chunk = getEngine().getMantle().getMantle().useChunk(blockX >> 4, blockZ >> 4);
|
||||
try {
|
||||
preserveSubterrain(planner, materials, caveCeilings, passageHeadroom, minimumY, blockX, blockZ, output,
|
||||
preserveSubterrain(planner, materials, caveCeilings, minimumY, blockX, blockZ, output,
|
||||
(worldX, y, worldZ) -> HydrologyCaveStorage.getIfPresent(chunk, worldX, y, worldZ));
|
||||
} finally {
|
||||
chunk.release();
|
||||
}
|
||||
}
|
||||
|
||||
private void preserveSubterrain(SubterrainPlanner planner, SubterrainSurfaceMaterials materials, int[] caveCeilings, long[] passageHeadroom,
|
||||
private void preserveSubterrain(SubterrainPlanner planner, SubterrainSurfaceMaterials materials, int[] caveCeilings,
|
||||
int minimumY, int blockX, int blockZ, Hunk<NativeBlockState> output, HydrologyCells hydrology) {
|
||||
SubterrainRasterizer.rasterize(planner, blockX >> 4, blockZ >> 4, (worldX, worldY, worldZ, cell) -> {
|
||||
int y = worldY - minimumY;
|
||||
@@ -282,7 +280,7 @@ public class IrisCarveModifier extends EngineAssignedModifier<NativeBlockState>
|
||||
}
|
||||
int x = worldX & 15;
|
||||
int z = worldZ & 15;
|
||||
if (!cell.solid() && CaveCeilingMask.masked(caveCeilings, passageHeadroom, PowerOfTwoCoordinates.packLocal16(x, z), y)) {
|
||||
if (!cell.solid() && caveCeilings != null && y > caveCeilings[PowerOfTwoCoordinates.packLocal16(x, z)]) {
|
||||
return;
|
||||
}
|
||||
if (hydrology.at(worldX, y, worldZ) != null) {
|
||||
@@ -310,10 +308,6 @@ public class IrisCarveModifier extends EngineAssignedModifier<NativeBlockState>
|
||||
new int[CaveCeilingMask.FIELD * CaveCeilingMask.FIELD], ceilings) ? ceilings : null;
|
||||
}
|
||||
|
||||
private static long[] passageHeadroom(IrisComplex complex, int chunkX, int chunkZ) {
|
||||
return CaveCeilingMask.headroom(chunkX, chunkZ, complex.getHydrologyRuntime(), new long[256]);
|
||||
}
|
||||
|
||||
private void restoreSubterrainSolids(Hunk<NativeBlockState> output, int chunkX, int chunkZ, boolean preserveFloorSupports,
|
||||
HydrologyCells hydrology) {
|
||||
SubterrainPlanner planner = getComplex().getSubterrainPlanner();
|
||||
@@ -476,7 +470,7 @@ public class IrisCarveModifier extends EngineAssignedModifier<NativeBlockState>
|
||||
CarveOwnership.Owner owner = carveOwner(hydrology, feature,
|
||||
context.terrainColumns() == null ? null : context.terrainColumns()[columnIndex], y);
|
||||
if (owner == CarveOwnership.Owner.SUBTERRAIN) {
|
||||
if (!feature.solid() && CaveCeilingMask.masked(context.caveCeilings(), context.passageHeadroom(), columnIndex, y)) {
|
||||
if (!feature.solid() && context.caveCeilings() != null && y > context.caveCeilings()[columnIndex]) {
|
||||
return;
|
||||
}
|
||||
context.output().setRaw(localX, y, localZ, SubterrainRasterizer.state(feature));
|
||||
@@ -566,8 +560,7 @@ public class IrisCarveModifier extends EngineAssignedModifier<NativeBlockState>
|
||||
int minimumY,
|
||||
IrisComplex complex,
|
||||
SubterrainPlanner.ChunkSampler subterrainSampler,
|
||||
int[] caveCeilings,
|
||||
long[] passageHeadroom
|
||||
int[] caveCeilings
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user