mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 00:04:42 +00:00
Give cave ceiling layers their own thickness noise
Ceiling layers borrowed the thickness noise of the surface layer at the same index, so ceiling layers beyond the surface layer count were dropped and the validator rejected such packs. Each ceiling layer now has its own cached noise, seeded as before, every declared layer is generated, and the validator accepts any count.
TerrainLayersPinTest re-baselined (length 143112 -> 147047, hash 149645537 -> 216639495). Only the MEADOW ceiling output changed, in both the plain and the exploded runs; surface, sea and smoothing output of every biome is identical, and the biomes without ceiling layers are untouched:
- MEADOW ceiling, plain: 5724 -> 7400 characters. Its fourth layer (basalt) is now emitted instead of cut off at the three surface layers.
- MEADOW ceiling, exploded: 13788 -> 16047 characters. Same fourth layer, plus the barrier separators around it.
- Layers 0 to 2 of MEADOW's ceiling now take thickness from their own style and zoom instead of the surface layers' (SIMPLEX zoom 0.3 against the default style for layer 0, the default style against CELLULAR zoom 0.25 for layer 1), so their block counts change at most columns, e.g. column -400,-400 went from "clay tuff deepslate calcite" to "clay clay tuff deepslate tuff calcite basalt".
Upstream: 23bad0e1a
This commit is contained in:
1 parent
5a2c5b2592
commit
7b2a232a42
8 files changed
+160
-60
No files matched your search
@@ -57,6 +57,7 @@ public final class BiomeLayers {
|
||||
private final ModuleLog log;
|
||||
private final Map<PaletteLayer, ResolvedLayer> resolved = new ConcurrentHashMap<>();
|
||||
private final Map<LayersSettings, AtomicCache<KList<LayerNoise>>> surfaceHeights = new ConcurrentHashMap<>();
|
||||
private final Map<CaveCeilingLayersSettings, AtomicCache<KList<LayerNoise>>> ceilingHeights = new ConcurrentHashMap<>();
|
||||
private final Map<SeaLayersSettings, AtomicCache<KList<LayerNoise>>> seaHeights = new ConcurrentHashMap<>();
|
||||
private final Map<ResourceId, LayeredBiome> biomes = new ConcurrentHashMap<>();
|
||||
|
||||
@@ -147,10 +148,8 @@ public final class BiomeLayers {
|
||||
return blocks;
|
||||
}
|
||||
|
||||
KList<LayerNoise> heightNoises = surfaceHeightNoises(surfaceSettings(biome), random);
|
||||
// Ceiling layers reuse the surface-layer height noise, so entries beyond the surface layers have none; skip them.
|
||||
int usableLayers = Math.min(ceilingLayers.size(), heightNoises.size());
|
||||
for (int i = 0; i < usableLayers; i++) {
|
||||
KList<LayerNoise> heightNoises = ceilingHeightNoises(biome.ceilingLayers(), random);
|
||||
for (int i = 0; i < ceilingLayers.size(); i++) {
|
||||
ResolvedLayer layer = resolve(ceilingLayers.get(i));
|
||||
double depth = layerThickness(layer, heightNoises.get(i), wx, wz);
|
||||
if (depth <= 0) {
|
||||
@@ -203,10 +202,8 @@ public final class BiomeLayers {
|
||||
return biome.seaLayers() == null ? List.of() : biome.seaLayers().layers();
|
||||
}
|
||||
|
||||
/** The biome's cave ceiling layers that place blocks: those with a surface layer at their place to borrow its thickness from. */
|
||||
public List<PaletteLayer> ceilingLayers(LayeredBiome biome) {
|
||||
List<PaletteLayer> declared = biome.ceilingLayers() == null ? List.of() : biome.ceilingLayers().layers();
|
||||
return declared.subList(0, Math.min(declared.size(), surfaceLayers(biome).size()));
|
||||
return biome.ceilingLayers() == null ? List.of() : biome.ceilingLayers().layers();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -231,7 +228,7 @@ public final class BiomeLayers {
|
||||
/** Cave ceiling layer {@code index}'s block {@code depth} blocks below the ceiling, as {@link #generateCeilingLayers} picks it. */
|
||||
public BlockState ceilingLayerBlock(LayeredBiome biome, int index, int depth, double wx, double wz, RNG random) {
|
||||
ResolvedLayer layer = resolve(ceilingLayers(biome).get(index));
|
||||
double thickness = layerThickness(layer, surfaceHeightNoises(surfaceSettings(biome), random).get(index), wx, wz);
|
||||
double thickness = layerThickness(layer, ceilingHeightNoises(biome.ceilingLayers(), random).get(index), wx, wz);
|
||||
return blockAtDepth(layer, index, depth, thickness, wx, wz, random);
|
||||
}
|
||||
|
||||
@@ -341,6 +338,11 @@ public final class BiomeLayers {
|
||||
return heightNoises(cache, settings.layers(), SURFACE_HEIGHT_SEED, rng);
|
||||
}
|
||||
|
||||
private KList<LayerNoise> ceilingHeightNoises(CaveCeilingLayersSettings settings, RNG rng) {
|
||||
AtomicCache<KList<LayerNoise>> cache = ceilingHeights.computeIfAbsent(settings, declared -> new AtomicCache<>());
|
||||
return heightNoises(cache, settings.layers(), SURFACE_HEIGHT_SEED, rng);
|
||||
}
|
||||
|
||||
private KList<LayerNoise> seaHeightNoises(SeaLayersSettings settings, RNG rng) {
|
||||
AtomicCache<KList<LayerNoise>> cache = seaHeights.computeIfAbsent(settings, declared -> new AtomicCache<>());
|
||||
return heightNoises(cache, settings.layers(), SEA_HEIGHT_SEED, rng);
|
||||
|
||||
@@ -29,10 +29,10 @@ import java.util.List;
|
||||
/**
|
||||
* The layers of material on the ceilings of caves in a biome, written as {@code "caveCeilingLayers": [...]}, the list of layers.
|
||||
*/
|
||||
@Desc("Layers of materials placed on cave ceilings in this biome, indexed upward from the ceiling surface. Must not have more entries than layers, whose height generators it reuses. Omitting this leaves cave ceilings unchanged.")
|
||||
@Desc("Layers of materials placed on cave ceilings in this biome, indexed upward from the ceiling surface. Each layer has its own thickness generator, so there may be more or fewer entries than layers. Omitting this leaves cave ceilings unchanged.")
|
||||
@Feature(id = "iris:terrain/cave-ceiling-layers", name = "Cave ceiling layers", key = "caveCeilingLayers", root = "layers", targets = Level.BIOME)
|
||||
public final class CaveCeilingLayersSettings implements IrisFeature {
|
||||
@Desc("Layers of materials placed on cave ceilings in this biome, indexed upward from the ceiling surface. Must not have more entries than layers, whose height generators it reuses. Omitting this leaves cave ceilings unchanged.")
|
||||
@Desc("Layers of materials placed on cave ceilings in this biome, indexed upward from the ceiling surface. Each layer has its own thickness generator, so there may be more or fewer entries than layers. Omitting this leaves cave ceilings unchanged.")
|
||||
private List<PaletteLayer> layers = List.of();
|
||||
|
||||
public CaveCeilingLayersSettings() {
|
||||
|
||||
Reference in new issue
Block a user