mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-29 01:04:29 +00:00
Check reachable biome fluids
- Engine start validates every reachable biome policy fluid while cave pools are enabled - caveFluidPolicies stays computed from cave biomes, regions and the dimension only
This commit is contained in:
1 parent
1e41c9eca0
commit
6f38d98e9e
3 files changed
+45
-2
No files matched your search
+33
@@ -30,10 +30,13 @@ import art.arcane.iris.generation.runtime.PreparedHydrologyCacheIdentity;
|
||||
import art.arcane.iris.generation.runtime.SeedManager;
|
||||
import art.arcane.iris.generation.terrain.IrisDimension;
|
||||
import art.arcane.iris.generation.terrain.IrisRegion;
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.pack.loading.ResourceLoader;
|
||||
import art.arcane.iris.spi.LogLevel;
|
||||
import art.arcane.iris.testsupport.FakeHydrology;
|
||||
import art.arcane.iris.testsupport.PlatformLeakGuard;
|
||||
import art.arcane.iris.world.IrisWorld;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import org.junit.After;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Rule;
|
||||
@@ -889,6 +892,36 @@ public class HydrologyRuntimeTest {
|
||||
verify(engine, never()).getComplex();
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void createChecksEveryReachableBiomeFluidWhileCavePoolsAreEnabled() {
|
||||
IrisDimension dimension = new IrisDimension().setRegions(new KList<>("tropical"));
|
||||
dimension.setHydrology(new IrisHydrology().setEnabled(true).setDensity(0D));
|
||||
IrisRegion tropical = new IrisRegion().setLandBiomes(new KList<>("volcanoes"));
|
||||
tropical.setLoadKey("tropical");
|
||||
IrisBiome volcanoes = new IrisBiome().setHydrologyPolicy(new IrisHydrologyPolicy().setFluid("magma"));
|
||||
volcanoes.setLoadKey("volcanoes");
|
||||
IrisData data = mock(IrisData.class);
|
||||
ResourceLoader<IrisRegion> regions = mock(ResourceLoader.class);
|
||||
ResourceLoader<IrisBiome> biomes = mock(ResourceLoader.class);
|
||||
when(data.getRegionLoader()).thenReturn(regions);
|
||||
when(data.getBiomeLoader()).thenReturn(biomes);
|
||||
when(regions.load("tropical")).thenReturn(tropical);
|
||||
when(biomes.load("volcanoes")).thenReturn(volcanoes);
|
||||
Engine engine = mock(Engine.class);
|
||||
when(engine.getDimension()).thenReturn(dimension);
|
||||
when(engine.getData()).thenReturn(data);
|
||||
when(engine.getSeedManager()).thenReturn(new SeedManager(1337L));
|
||||
when(engine.getHeight()).thenReturn(384);
|
||||
IrisComplex complex = mock(IrisComplex.class);
|
||||
|
||||
IllegalArgumentException failure = assertThrows(IllegalArgumentException.class, () -> HydrologyRuntime.create(engine, complex));
|
||||
assertTrue(failure.getMessage(), failure.getMessage().contains("'magma'") && failure.getMessage().contains("volcanoes"));
|
||||
|
||||
dimension.getHydrology().getUnderground().getCavePools().setEnabled(false);
|
||||
assertDisabled(HydrologyRuntime.create(engine, complex));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void zeroDensitySkipsRuntimePlanningAfterValidatingSettings() {
|
||||
Engine engine = mock(Engine.class);
|
||||
|
||||
+1
@@ -95,6 +95,7 @@ public class IrisEngineGenerationRuntimeScopeTest {
|
||||
when(historical.dimension.getHydrology()).thenReturn(new IrisHydrology().setEnabled(true).setPersist(false).setPrefetchRings(0));
|
||||
when(historical.dimension.getFluidHeight()).thenReturn(40);
|
||||
when(historical.dimension.getLoadKey()).thenReturn("historical");
|
||||
when(historical.dimension.getReachableBiomes(any())).thenReturn(new KList<>());
|
||||
when(historical.dimension.getAllRegions(any())).thenReturn(new KList<>());
|
||||
when(historical.dimension.getReachableCaveBiomes(any())).thenReturn(new KList<>());
|
||||
when(historical.target.getWorld().getHeight()).thenReturn(384);
|
||||
|
||||
Reference in new issue
Block a user