mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 16:54:04 +00:00
Remove dead cave cell code
- Drop HydrologyCaveAction.FALLING_FLUID; saved code 2 stays reserved and loads as WET_SOURCE - Drop the flooded biome key from cave cells, Engine.floodedCaveBiome and the sea inlet rasterizer argument - Write the retired biome slot empty and skip it on read so saved plates keep loading - Drop the constant protectsPlacement check from every caller - Drop the test-only of() factories and the default fluid key; tests use real keys - Drop the unused falling-fluid carve state and isFalling
This commit is contained in:
1 parent
b195582259
commit
df7aa2ef16
45 files changed
+155
-244
No files matched your search
@@ -2,7 +2,6 @@ package art.arcane.iris.generation.hydrology.cave;
|
||||
|
||||
public enum HydrologyCaveAction {
|
||||
WET_SOURCE,
|
||||
FALLING_FLUID,
|
||||
DRY_AIR,
|
||||
SEAL_GUARD,
|
||||
POOL_SOURCE
|
||||
|
||||
+7
-38
@@ -6,56 +6,32 @@ import java.util.Objects;
|
||||
|
||||
public final class HydrologyCaveCell {
|
||||
public static final String SEA_FLUID = "@sea";
|
||||
private static final String DEFAULT_FLUID_PROFILE_KEY = "default";
|
||||
private static final byte LIQUID_FLUID = 1;
|
||||
private static final byte LIQUID_FORCED_AIR = 3;
|
||||
|
||||
private final HydrologyCaveAction action;
|
||||
private final String fluidProfileKey;
|
||||
private final String floodedBiomeKey;
|
||||
private final MatterCavern cavern;
|
||||
|
||||
public HydrologyCaveCell(
|
||||
HydrologyCaveAction action,
|
||||
String fluidProfileKey,
|
||||
String floodedBiomeKey
|
||||
) {
|
||||
public HydrologyCaveCell(HydrologyCaveAction action, String fluidProfileKey) {
|
||||
this.action = Objects.requireNonNull(action);
|
||||
if (fluidProfileKey == null || fluidProfileKey.isBlank()) {
|
||||
throw new IllegalArgumentException("fluidProfileKey must not be blank");
|
||||
}
|
||||
this.fluidProfileKey = fluidProfileKey.trim();
|
||||
this.floodedBiomeKey = floodedBiomeKey == null ? "" : floodedBiomeKey.trim();
|
||||
this.cavern = switch (action) {
|
||||
case WET_SOURCE, FALLING_FLUID, POOL_SOURCE -> new MatterCavern(true, this.floodedBiomeKey, LIQUID_FLUID);
|
||||
case DRY_AIR -> new MatterCavern(true, this.floodedBiomeKey, LIQUID_FORCED_AIR);
|
||||
case WET_SOURCE, POOL_SOURCE -> new MatterCavern(true, "", LIQUID_FLUID);
|
||||
case DRY_AIR -> new MatterCavern(true, "", LIQUID_FORCED_AIR);
|
||||
case SEAL_GUARD -> null;
|
||||
};
|
||||
}
|
||||
|
||||
public static HydrologyCaveCell of(HydrologyCaveAction action) {
|
||||
return new HydrologyCaveCell(action, DEFAULT_FLUID_PROFILE_KEY, "");
|
||||
}
|
||||
|
||||
public static HydrologyCaveCell of(HydrologyCaveAction action, String fluidProfileKey) {
|
||||
return new HydrologyCaveCell(action, fluidProfileKey, "");
|
||||
}
|
||||
|
||||
public boolean carves() {
|
||||
return action != HydrologyCaveAction.SEAL_GUARD;
|
||||
}
|
||||
|
||||
public boolean isWet() {
|
||||
return action == HydrologyCaveAction.WET_SOURCE || action == HydrologyCaveAction.FALLING_FLUID
|
||||
|| action == HydrologyCaveAction.POOL_SOURCE;
|
||||
}
|
||||
|
||||
public boolean isFalling() {
|
||||
return action == HydrologyCaveAction.FALLING_FLUID;
|
||||
}
|
||||
|
||||
public boolean protectsPlacement() {
|
||||
return true;
|
||||
return action == HydrologyCaveAction.WET_SOURCE || action == HydrologyCaveAction.POOL_SOURCE;
|
||||
}
|
||||
|
||||
public MatterCavern asCavern() {
|
||||
@@ -66,10 +42,6 @@ public final class HydrologyCaveCell {
|
||||
return action;
|
||||
}
|
||||
|
||||
public String floodedBiomeKey() {
|
||||
return floodedBiomeKey;
|
||||
}
|
||||
|
||||
public String fluidProfileKey() {
|
||||
return fluidProfileKey;
|
||||
}
|
||||
@@ -82,19 +54,16 @@ public final class HydrologyCaveCell {
|
||||
if (!(object instanceof HydrologyCaveCell hydrology)) {
|
||||
return false;
|
||||
}
|
||||
return action == hydrology.action
|
||||
&& fluidProfileKey.equals(hydrology.fluidProfileKey)
|
||||
&& floodedBiomeKey.equals(hydrology.floodedBiomeKey);
|
||||
return action == hydrology.action && fluidProfileKey.equals(hydrology.fluidProfileKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (31 * ((31 * action.hashCode()) + fluidProfileKey.hashCode())) + floodedBiomeKey.hashCode();
|
||||
return (31 * action.hashCode()) + fluidProfileKey.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "HydrologyCaveCell[action=" + action + ", fluidProfileKey=" + fluidProfileKey
|
||||
+ ", floodedBiomeKey=" + floodedBiomeKey + "]";
|
||||
return "HydrologyCaveCell[action=" + action + ", fluidProfileKey=" + fluidProfileKey + "]";
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -142,8 +142,8 @@ public final class CavePoolFiller {
|
||||
}
|
||||
|
||||
private static void write(int chunkX, int chunkZ, Pool pool, MantleWriter writer) {
|
||||
HydrologyCaveCell wet = new HydrologyCaveCell(HydrologyCaveAction.POOL_SOURCE, pool.fluid(), "");
|
||||
HydrologyCaveCell wall = new HydrologyCaveCell(HydrologyCaveAction.SEAL_GUARD, pool.fluid(), "");
|
||||
HydrologyCaveCell wet = new HydrologyCaveCell(HydrologyCaveAction.POOL_SOURCE, pool.fluid());
|
||||
HydrologyCaveCell wall = new HydrologyCaveCell(HydrologyCaveAction.SEAL_GUARD, pool.fluid());
|
||||
for (int offsetX = -1; offsetX <= 1; offsetX++) {
|
||||
for (int offsetZ = -1; offsetZ <= 1; offsetZ++) {
|
||||
int targetX = chunkX + offsetX;
|
||||
|
||||
+4
-4
@@ -13,7 +13,7 @@ public final class SeaInletRasterizer {
|
||||
private static final int GRID = CHUNK + 2 * SHELL;
|
||||
static final int NONE = Integer.MIN_VALUE;
|
||||
|
||||
public void write(SeaInlet inlet, int chunkX, int chunkZ, MantleWriter writer, String fluid, String floodedBiome, SubterrainFluid subterrain,
|
||||
public void write(SeaInlet inlet, int chunkX, int chunkZ, MantleWriter writer, String fluid, SubterrainFluid subterrain,
|
||||
HistoricalChunks historical) {
|
||||
if (!touches(inlet, chunkX, chunkZ)) {
|
||||
return;
|
||||
@@ -23,9 +23,9 @@ public final class SeaInletRasterizer {
|
||||
if (!shape(inlet, (chunkX << 4) - SHELL, (chunkZ << 4) - SHELL, GRID, floors, ceilings)) {
|
||||
return;
|
||||
}
|
||||
HydrologyCaveCell wet = new HydrologyCaveCell(HydrologyCaveAction.WET_SOURCE, fluid, floodedBiome);
|
||||
HydrologyCaveCell dry = new HydrologyCaveCell(HydrologyCaveAction.DRY_AIR, fluid, floodedBiome);
|
||||
HydrologyCaveCell guard = new HydrologyCaveCell(HydrologyCaveAction.SEAL_GUARD, fluid, floodedBiome);
|
||||
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 = inlet.waterLevel();
|
||||
boolean[] historicalAround = historicalAround(chunkX, chunkZ, historical);
|
||||
for (int lz = 0; lz < CHUNK; lz++) {
|
||||
|
||||
+1
-2
@@ -112,8 +112,7 @@ final class CaveObjectPlacementTransaction implements IObjectPlacer {
|
||||
discard();
|
||||
return CommitResult.REJECTED_SUBTERRAIN;
|
||||
}
|
||||
HydrologyCaveCell hydrology = delegate.getData(x, y, z, HydrologyCaveCell.class);
|
||||
if (hydrology != null && hydrology.protectsPlacement()) {
|
||||
if (delegate.getData(x, y, z, HydrologyCaveCell.class) != null) {
|
||||
discard();
|
||||
return CommitResult.REJECTED_HYDROLOGY;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public final class CaveTerrainSnapshot {
|
||||
bytes += 16L + (long) section.length * 8L;
|
||||
for (HydrologyCaveCell cell : section) {
|
||||
if (cell != null) {
|
||||
bytes += 208L + ((long) cell.fluidProfileKey().length() + cell.floodedBiomeKey().length()) * 2L;
|
||||
bytes += 208L + (long) cell.fluidProfileKey().length() * 2L;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public final class MantleHydrologyComponent extends IrisMantleComponent {
|
||||
if (!inlets.isEmpty()) {
|
||||
SeaInletRasterizer.SubterrainFluid subterrain = subterrainFluid(writer, complex, chunkX, chunkZ);
|
||||
for (SeaInlet inlet : inlets) {
|
||||
INLETS.write(inlet, chunkX, chunkZ, writer, HydrologyCaveCell.SEA_FLUID, "", subterrain, complex::isHistoricalChunk);
|
||||
INLETS.write(inlet, chunkX, chunkZ, writer, HydrologyCaveCell.SEA_FLUID, subterrain, complex::isHistoricalChunk);
|
||||
}
|
||||
}
|
||||
generateFalls(writer, complex, runtime, own, chunkX, chunkZ);
|
||||
|
||||
@@ -897,7 +897,7 @@ public class MantleObjectComponent extends IrisMantleComponent {
|
||||
int y,
|
||||
int lavaHeight
|
||||
) {
|
||||
if (hydrology != null && hydrology.protectsPlacement()) {
|
||||
if (hydrology != null) {
|
||||
return false;
|
||||
}
|
||||
if (cavern == null || !cavern.isCavern()) {
|
||||
|
||||
@@ -585,8 +585,7 @@ public class MantleWriter implements ObjectPassPlacer, AutoCloseable {
|
||||
if (slice == null) {
|
||||
return false;
|
||||
}
|
||||
HydrologyCaveCell hydrology = slice.get(x & 15, y & 15, z & 15);
|
||||
return hydrology != null && hydrology.protectsPlacement();
|
||||
return slice.get(x & 15, y & 15, z & 15) != null;
|
||||
}
|
||||
|
||||
private static void clearTile(Matter matter, int x, int y, int z) {
|
||||
|
||||
+1
-2
@@ -491,8 +491,7 @@ final class ObjectDestinationTransaction implements ObjectPassPlacer {
|
||||
}
|
||||
|
||||
private boolean hasProtectedHydrology(int x, int y, int z) {
|
||||
HydrologyCaveCell hydrology = getDataIfPresent(x, y, z, HydrologyCaveCell.class);
|
||||
return hydrology != null && hydrology.protectsPlacement();
|
||||
return getDataIfPresent(x, y, z, HydrologyCaveCell.class) != null;
|
||||
}
|
||||
|
||||
private final class CommitJournal {
|
||||
|
||||
@@ -364,7 +364,7 @@ final class ObjectSourcePlan {
|
||||
case Identifier identifier -> 24L + stringBytes(identifier.namespace()) + stringBytes(identifier.key());
|
||||
case NativeBlockState ignored -> 0L;
|
||||
case MatterCavern cavern -> 24L + stringBytes(cavern.getCustomBiome());
|
||||
case HydrologyCaveCell cell -> 48L + stringBytes(cell.fluidProfileKey()) + stringBytes(cell.floodedBiomeKey());
|
||||
case HydrologyCaveCell cell -> 48L + stringBytes(cell.fluidProfileKey());
|
||||
case MatterMarker marker -> 16L + stringBytes(marker.getTag());
|
||||
case TileWrapper ignored -> 4L * UNKNOWN_PAYLOAD_BYTES;
|
||||
case Enum<?> ignored -> 0L;
|
||||
|
||||
@@ -47,8 +47,6 @@ import art.arcane.iris.pack.value.IrisPosition;
|
||||
import art.arcane.iris.generation.terrain.IrisRegion;
|
||||
import art.arcane.iris.structure.placement.IrisStructure;
|
||||
import art.arcane.iris.world.IrisWorld;
|
||||
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveCell;
|
||||
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveStorage;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBiome;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
@@ -367,24 +365,10 @@ public interface Engine extends DataProvider, Fallible, BlockUpdater, Renderer,
|
||||
if (featureBiome != null) {
|
||||
return featureBiome;
|
||||
}
|
||||
IrisBiome mantleBiome = mantleCaveBiome(x, y, z);
|
||||
IrisBiome mantleBiome = customCaveBiome(getMantle().getMantle().get(x, y, z, MatterCavern.class));
|
||||
return mantleBiome != null ? mantleBiome : getCaveBiome(x, y, z);
|
||||
}
|
||||
|
||||
private IrisBiome mantleCaveBiome(int x, int y, int z) {
|
||||
IrisBiome flooded = floodedCaveBiome(x, y, z);
|
||||
return flooded != null ? flooded : customCaveBiome(getMantle().getMantle().get(x, y, z, MatterCavern.class));
|
||||
}
|
||||
|
||||
private IrisBiome floodedCaveBiome(int x, int y, int z) {
|
||||
HydrologyCaveCell hydrology = HydrologyCaveStorage.getIfPresent(
|
||||
getMantle().getMantle(), x, y, z);
|
||||
if (hydrology != null && !hydrology.floodedBiomeKey().isEmpty()) {
|
||||
return getData().getBiomeLoader().load(hydrology.floodedBiomeKey());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private IrisBiome customCaveBiome(MatterCavern cavern) {
|
||||
if (cavern != null && cavern.getCustomBiome() != null && !cavern.getCustomBiome().isEmpty()) {
|
||||
return getData().getBiomeLoader().load(cavern.getCustomBiome());
|
||||
@@ -439,15 +423,12 @@ public interface Engine extends DataProvider, Fallible, BlockUpdater, Renderer,
|
||||
biomes[index] = surface;
|
||||
continue;
|
||||
}
|
||||
IrisBiome biome = floodedCaveBiome(x, y, z);
|
||||
if (biome == null) {
|
||||
if (!cavernChunkResolved) {
|
||||
cavernChunk = useCavernChunk(x, z);
|
||||
cavernChunkResolved = true;
|
||||
}
|
||||
biome = cavernChunk == null || y < 0 || y >= getMantle().getMantle().getWorldHeight()
|
||||
? null : customCaveBiome(cavernChunk.get(x & 15, y, z & 15, MatterCavern.class));
|
||||
if (!cavernChunkResolved) {
|
||||
cavernChunk = useCavernChunk(x, z);
|
||||
cavernChunkResolved = true;
|
||||
}
|
||||
IrisBiome biome = cavernChunk == null || y < 0 || y >= getMantle().getMantle().getWorldHeight()
|
||||
? null : customCaveBiome(cavernChunk.get(x & 15, y, z & 15, MatterCavern.class));
|
||||
if (biome == null) {
|
||||
biome = resolveConfiguredCaveBiome(x, y, z, null);
|
||||
}
|
||||
|
||||
@@ -419,7 +419,6 @@ public class IrisCarveModifier extends EngineAssignedModifier<NativeBlockState>
|
||||
}
|
||||
return switch (hydrology.action()) {
|
||||
case WET_SOURCE, POOL_SOURCE -> fluid;
|
||||
case FALLING_FLUID -> fallingFluidState(fluid);
|
||||
case DRY_AIR -> air;
|
||||
case SEAL_GUARD -> normalizeWaterlogging(current, null);
|
||||
};
|
||||
@@ -450,16 +449,6 @@ public class IrisCarveModifier extends EngineAssignedModifier<NativeBlockState>
|
||||
return normalizeWaterlogging(state, resultingFluid);
|
||||
}
|
||||
|
||||
private static NativeBlockState fallingFluidState(NativeBlockState fluid) {
|
||||
if (fluid == null || !IrisProceduralBlocks.hasProperty(fluid, "level")) {
|
||||
return fluid;
|
||||
}
|
||||
if ("8".equals(IrisProceduralBlocks.propertyValue(fluid, "level"))) {
|
||||
return fluid;
|
||||
}
|
||||
return fluid.withProperty("level", "8");
|
||||
}
|
||||
|
||||
private final class CarveResolver {
|
||||
private final CarveResolutionContext context;
|
||||
|
||||
@@ -643,7 +632,7 @@ public class IrisCarveModifier extends EngineAssignedModifier<NativeBlockState>
|
||||
HydrologyCaveCell hydrology = terrain.hydrology(rx, yy, rz);
|
||||
int worldX = rx + chunkBlockX;
|
||||
int worldZ = rz + chunkBlockZ;
|
||||
if (hydrology != null && hydrology.protectsPlacement() || inputs.cells.cell(worldX, yy, worldZ).owned()
|
||||
if (hydrology != null || inputs.cells.cell(worldX, yy, worldZ).owned()
|
||||
|| yy >= surfaceHeights[PowerOfTwoCoordinates.packLocal16(rx, rz)] || !B.isSolid(output.getRaw(rx, yy, rz))) {
|
||||
return;
|
||||
}
|
||||
@@ -892,9 +881,7 @@ public class IrisCarveModifier extends EngineAssignedModifier<NativeBlockState>
|
||||
break;
|
||||
}
|
||||
HydrologyCaveCell hydrology = terrain.hydrology(rx, floorY, rz);
|
||||
if (hydrology != null
|
||||
&& hydrology.protectsPlacement()
|
||||
&& hydrology.action() != HydrologyCaveAction.SEAL_GUARD) {
|
||||
if (hydrology != null && hydrology.action() != HydrologyCaveAction.SEAL_GUARD) {
|
||||
continue;
|
||||
}
|
||||
NativeBlockState existing = output.getRaw(rx, floorY, rz);
|
||||
@@ -922,9 +909,7 @@ public class IrisCarveModifier extends EngineAssignedModifier<NativeBlockState>
|
||||
break;
|
||||
}
|
||||
HydrologyCaveCell hydrology = terrain.hydrology(rx, ceilingY, rz);
|
||||
if (hydrology != null
|
||||
&& hydrology.protectsPlacement()
|
||||
&& hydrology.action() != HydrologyCaveAction.SEAL_GUARD) {
|
||||
if (hydrology != null && hydrology.action() != HydrologyCaveAction.SEAL_GUARD) {
|
||||
continue;
|
||||
}
|
||||
NativeBlockState existing = output.getRaw(rx, ceilingY, rz);
|
||||
@@ -988,9 +973,7 @@ public class IrisCarveModifier extends EngineAssignedModifier<NativeBlockState>
|
||||
}
|
||||
int y = zone.floor - i - 1;
|
||||
HydrologyCaveCell hydrology = terrain.hydrology(rx, y, rz);
|
||||
if (hydrology != null
|
||||
&& hydrology.protectsPlacement()
|
||||
&& hydrology.action() != HydrologyCaveAction.SEAL_GUARD) {
|
||||
if (hydrology != null && hydrology.action() != HydrologyCaveAction.SEAL_GUARD) {
|
||||
continue;
|
||||
}
|
||||
NativeBlockState block = resolveSubmergedCaveFloorLayer(
|
||||
@@ -1017,9 +1000,7 @@ public class IrisCarveModifier extends EngineAssignedModifier<NativeBlockState>
|
||||
break;
|
||||
}
|
||||
HydrologyCaveCell hydrology = terrain.hydrology(rx, cy, rz);
|
||||
if (hydrology != null
|
||||
&& hydrology.protectsPlacement()
|
||||
&& hydrology.action() != HydrologyCaveAction.SEAL_GUARD) {
|
||||
if (hydrology != null && hydrology.action() != HydrologyCaveAction.SEAL_GUARD) {
|
||||
continue;
|
||||
}
|
||||
NativeBlockState block = ceilingBlocks.get(i);
|
||||
|
||||
@@ -441,8 +441,7 @@ public class IrisDepositModifier extends EngineAssignedModifier<NativeBlockState
|
||||
}
|
||||
|
||||
private static boolean protectedHydrology(MantleChunk chunk, int x, int y, int z) {
|
||||
Object cell = chunk.get(x, y, z, HydrologyCaveCell.class);
|
||||
return cell instanceof HydrologyCaveCell hydrology && hydrology.protectsPlacement();
|
||||
return chunk.get(x, y, z, HydrologyCaveCell.class) instanceof HydrologyCaveCell;
|
||||
}
|
||||
|
||||
static boolean canReplaceDepositTarget(NativeBlockState state) {
|
||||
|
||||
@@ -24,7 +24,6 @@ import art.arcane.iris.generation.mantle.EngineMantle;
|
||||
import art.arcane.iris.generation.biome.IrisBiome;
|
||||
import art.arcane.iris.generation.terrain.IrisDimension;
|
||||
import art.arcane.iris.generation.decoration.IrisProceduralBlocks;
|
||||
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveCell;
|
||||
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveStorage;
|
||||
import art.arcane.iris.generation.hydrology.raster.WaterRole;
|
||||
import art.arcane.iris.generation.terrain.IrisSlopeClip;
|
||||
@@ -358,8 +357,7 @@ public class IrisPostModifier extends EngineAssignedModifier<NativeBlockState> {
|
||||
if (mantle == null) {
|
||||
return false;
|
||||
}
|
||||
HydrologyCaveCell cell = HydrologyCaveStorage.getIfPresent(mantle.getMantle(), x, y, z);
|
||||
return cell != null && cell.protectsPlacement();
|
||||
return HydrologyCaveStorage.getIfPresent(mantle.getMantle(), x, y, z) != null;
|
||||
}
|
||||
|
||||
public void setPostBlock(int x, int y, int z, NativeBlockState d, int originX, int originZ, Hunk<NativeBlockState> currentData) {
|
||||
|
||||
+2
-2
@@ -274,7 +274,7 @@ public final class StructureCaveAnchorResolver {
|
||||
int blockZ
|
||||
) {
|
||||
HydrologyCaveCell hydrology = hydrologyAt(engine, blockX, mantleY, blockZ);
|
||||
if (hydrology != null && hydrology.protectsPlacement()) {
|
||||
if (hydrology != null) {
|
||||
return false;
|
||||
}
|
||||
MatterCavern cavern = engine.getMantle().getMantle()
|
||||
@@ -303,7 +303,7 @@ public final class StructureCaveAnchorResolver {
|
||||
int mantleY,
|
||||
int defaultLavaHeight
|
||||
) {
|
||||
if (hydrology != null && hydrology.protectsPlacement()) {
|
||||
if (hydrology != null) {
|
||||
return false;
|
||||
}
|
||||
if (cavern == null || !cavern.isCavern()) {
|
||||
|
||||
@@ -275,7 +275,7 @@ public final class GenerationSemanticCapture {
|
||||
blockX,
|
||||
y,
|
||||
blockZ,
|
||||
cell == null ? null : cell.floodedBiomeKey()
|
||||
null
|
||||
);
|
||||
if (cell != null && cell.isWet() && cell.fluidProfileKey() != null && !cell.fluidProfileKey().isBlank()
|
||||
&& !HydrologyCaveCell.SEA_FLUID.equals(cell.fluidProfileKey())) {
|
||||
|
||||
@@ -29,19 +29,20 @@ public final class HydrologyCaveMatter extends RawMatter<HydrologyCaveCell> {
|
||||
public void writeNode(HydrologyCaveCell hydrology, DataOutputStream output) throws IOException {
|
||||
output.writeByte(actionCode(hydrology.action()));
|
||||
output.writeUTF(hydrology.fluidProfileKey());
|
||||
output.writeUTF(hydrology.floodedBiomeKey());
|
||||
output.writeUTF("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public HydrologyCaveCell readNode(DataInputStream input) throws IOException {
|
||||
HydrologyCaveAction action = actionFromCode(input.readUnsignedByte());
|
||||
return new HydrologyCaveCell(action, input.readUTF(), input.readUTF());
|
||||
String fluidProfileKey = input.readUTF();
|
||||
input.readUTF();
|
||||
return new HydrologyCaveCell(action, fluidProfileKey);
|
||||
}
|
||||
|
||||
private int actionCode(HydrologyCaveAction action) {
|
||||
return switch (action) {
|
||||
case WET_SOURCE -> 1;
|
||||
case FALLING_FLUID -> 2;
|
||||
case DRY_AIR -> 3;
|
||||
case SEAL_GUARD -> 4;
|
||||
case POOL_SOURCE -> 5;
|
||||
@@ -50,8 +51,7 @@ public final class HydrologyCaveMatter extends RawMatter<HydrologyCaveCell> {
|
||||
|
||||
private HydrologyCaveAction actionFromCode(int code) throws IOException {
|
||||
return switch (code) {
|
||||
case 1 -> HydrologyCaveAction.WET_SOURCE;
|
||||
case 2 -> HydrologyCaveAction.FALLING_FLUID;
|
||||
case 1, 2 -> HydrologyCaveAction.WET_SOURCE;
|
||||
case 3 -> HydrologyCaveAction.DRY_AIR;
|
||||
case 4 -> HydrologyCaveAction.SEAL_GUARD;
|
||||
case 5 -> HydrologyCaveAction.POOL_SOURCE;
|
||||
|
||||
Reference in new issue
Block a user