Natural stronghold ring biomes

- The modded structure-state biome lookup resolves from the natural true biome stream, the same as the Bukkit ring search
- Stronghold ring placement no longer plans hydrology tiles around its 128 positions, so chunk structure starts stop waiting on river plans out to ~24k blocks
- Ring lookups are cached per runtime and cleared with the other biome caches
This commit is contained in:
Brian Neumann-Fopiano committed 2026-09-29 03:56:40 -04:00
1 parent 4da9661885
commit 6fd877ebfc
2 files changed
+65 -1

No files matched your search

@@ -1,6 +1,12 @@
package art.arcane.iris.modded;
import art.arcane.iris.generation.biome.IrisBiome;
import art.arcane.iris.generation.runtime.Engine;
import art.arcane.iris.generation.runtime.GenerationSessionLease;
import art.arcane.iris.generation.runtime.IrisComplex;
import art.arcane.volmlib.nativelib.terrain.NativeBiomeSourceAccess;
import art.arcane.volmlib.util.stream.ProceduralStream;
import art.arcane.volmlib.util.stream.interpolation.Interpolated;
import org.junit.Test;
import java.util.ArrayList;
@@ -13,6 +19,9 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class ModdedBiomePolicyTest {
@Test
@@ -52,6 +61,29 @@ public class ModdedBiomePolicyTest {
assertTrue(failure.getMessage().contains("example:missing"));
}
@Test
public void structureRingBiomesResolveFromTheNaturalSurfaceWithoutPlanningHydrology() throws Exception {
BiomeToken forest = new BiomeToken("minecraft:forest");
IrisBiome natural = mock(IrisBiome.class);
when(natural.getStructureDerivativeKey()).thenReturn(forest.key());
IrisComplex complex = mock(IrisComplex.class);
when(complex.getNaturalTrueBiomeStream()).thenReturn(
ProceduralStream.of((x, z) -> natural, Interpolated.of(value -> 0D, value -> null)));
when(complex.getTrueBiomeStream()).thenThrow(
new AssertionError("Stronghold ring lookups must not plan hydrology"));
Engine engine = mock(Engine.class);
when(engine.getComplex()).thenReturn(complex);
when(engine.getMinHeight()).thenReturn(-64);
when(engine.acquireGenerationLease(anyString())).thenReturn(GenerationSessionLease.noop());
ModdedBiomePolicy<BiomeToken, Object> policy = new ModdedBiomePolicy<>(
new Access(new ArrayList<>(List.of(forest))));
policy.bind(new ModdedBiomePolicy.RuntimeCallbacks(() -> engine, () -> engine, bound -> true,
() -> Set.of(forest.key()), bound -> Set.of(), () -> 0L));
assertSame(forest, policy.requiredStructureBiome(6000, 0, -6000, null));
assertSame(forest, policy.requiredStructureBiome(6000, -30, -6000, null));
}
private static ModdedBiomePolicy<BiomeToken, Object> policy(List<BiomeToken> entries,
AtomicReference<Set<String>> configured) {
ModdedBiomePolicy<BiomeToken, Object> policy = new ModdedBiomePolicy<>(new Access(entries));