mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 08:44:50 +00:00
Deferred cave pool terrain
- Opened the cave pool terrain view only for chunks that draw a pool site - Added a test that chunks without a pool site never open their caves
This commit is contained in:
1 parent
3c39092cc7
commit
1899de7f3d
4 files changed
+36
-10
No files matched your search
+6
-1
@@ -10,6 +10,7 @@ import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public final class CavePoolFiller {
|
||||
public static final int REACH = HydrologySettings.MAX_CAVE_POOL_RADIUS + 1;
|
||||
@@ -40,15 +41,19 @@ public final class CavePoolFiller {
|
||||
this.density = settings.density();
|
||||
}
|
||||
|
||||
public void fill(int chunkX, int chunkZ, CarvedTerrain carved, MantleWriter writer, long seed) {
|
||||
public void fill(int chunkX, int chunkZ, Supplier<? extends CarvedTerrain> terrain, MantleWriter writer, long seed) {
|
||||
if (!pools.enabled() || density == 0f) {
|
||||
return;
|
||||
}
|
||||
int attempts = attempts(seed, chunkX, chunkZ);
|
||||
CarvedTerrain carved = null;
|
||||
for (int attempt = 0; attempt < attempts; attempt++) {
|
||||
if (density < 1f && CellHash.unit(CellHash.mix(seed, SALT_DENSITY + attempt, chunkX, chunkZ)) >= density) {
|
||||
continue;
|
||||
}
|
||||
if (carved == null) {
|
||||
carved = terrain.get();
|
||||
}
|
||||
long column = CellHash.mix(seed, SALT_COLUMN + attempt, chunkX, chunkZ);
|
||||
int x = (chunkX << 4) + (int) (column & 15);
|
||||
int z = (chunkZ << 4) + (int) ((column >>> 4) & 15);
|
||||
|
||||
@@ -85,8 +85,9 @@ public final class MantleHydrologyComponent extends IrisMantleComponent {
|
||||
generateFalls(writer, complex, runtime, own, chunkX, chunkZ);
|
||||
if (poolsActive()) {
|
||||
HydrologySettings settings = runtime.settings();
|
||||
new CavePoolFiller(settings).fill(chunkX, chunkZ,
|
||||
new MantleCarvedTerrain(writer, complex, getEngineMantle().getEngine(), chunkX, chunkZ), writer, settings.seed());
|
||||
Engine engine = getEngineMantle().getEngine();
|
||||
new CavePoolFiller(settings).fill(chunkX, chunkZ, () -> new MantleCarvedTerrain(writer, complex, engine, chunkX, chunkZ), writer,
|
||||
settings.seed());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user