mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-28 23:10:32 +00:00
Well.. not for now at least let me just remove that-
This commit is contained in:
1 parent
b7499d23f2
commit
3766a40256
12 files changed
+21
-122
No files matched your search
-62
@@ -1,62 +0,0 @@
|
||||
package art.arcane.iris.generation.runtime;
|
||||
|
||||
import art.arcane.iris.generation.runtime.EngineEffects;
|
||||
import art.arcane.iris.generation.runtime.EngineMode;
|
||||
import art.arcane.iris.generation.runtime.EngineTarget;
|
||||
import art.arcane.iris.generation.runtime.EngineWorldManager;
|
||||
import art.arcane.iris.structure.object.ObjectPlaceMode;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
public class EnginePlacementLifecycleTest {
|
||||
@Test
|
||||
public void runtimeAssemblyResolvesBeforePublicationAndKeepsOldPlansIntact() {
|
||||
var initial = assembly(1);
|
||||
EngineRuntime previous = initial.freezeRuntime(new GenerationRuntime.BiomeMaxes(0, 0, 0));
|
||||
var replacement = assembly(2);
|
||||
EngineRuntime next = replacement.freezeRuntime(new GenerationRuntime.BiomeMaxes(0, 0, 0));
|
||||
|
||||
assertSame(initial.placementLifecycles, previous.generation().placementLifecycles());
|
||||
assertSame(replacement.placementLifecycles, next.generation().placementLifecycles());
|
||||
for (ObjectPlaceMode mode : ObjectPlaceMode.values()) {
|
||||
assertNotNull(next.generation().placementLifecycles().get(mode));
|
||||
assertNotSame(previous.generation().placementLifecycles().get(mode), next.generation().placementLifecycles().get(mode));
|
||||
}
|
||||
assertSame(initial.placementLifecycles, previous.generation().placementLifecycles());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void complexReplacementCarriesNewPlansAlongsideTheNewComplex() {
|
||||
var initial = assembly(1);
|
||||
EngineRuntime previous = initial.freezeRuntime(new GenerationRuntime.BiomeMaxes(0, 0, 0));
|
||||
var replacement = assembly(2);
|
||||
EngineRuntime next = previous.withGeneration(previous.generation().withComplex(2, replacement.complex, null, null,
|
||||
new GenerationRuntime.BiomeMaxes(1, 1, 1), replacement.placementLifecycles));
|
||||
|
||||
assertSame(replacement.placementLifecycles, next.generation().placementLifecycles());
|
||||
assertSame(replacement.complex, next.generation().complex());
|
||||
assertSame(previous.worldManager(), next.worldManager());
|
||||
assertSame(initial.placementLifecycles, previous.generation().placementLifecycles());
|
||||
}
|
||||
|
||||
private EngineRuntimeBuilder.RuntimeAssembly assembly(int id) {
|
||||
EngineTarget target = mock(EngineTarget.class);
|
||||
var world = mock(art.arcane.iris.world.IrisWorld.class);
|
||||
org.mockito.Mockito.when(target.getWorld()).thenReturn(world);
|
||||
org.mockito.Mockito.when(target.getData()).thenReturn(mock(art.arcane.iris.pack.loading.IrisData.class));
|
||||
org.mockito.Mockito.when(target.getDimension()).thenReturn(mock(art.arcane.iris.generation.terrain.IrisDimension.class));
|
||||
var assembly = new EngineRuntimeBuilder.RuntimeAssembly(id, target,
|
||||
java.nio.file.Path.of("build", "test-mantles", "placement-" + id));
|
||||
assembly.mantle = mock(art.arcane.iris.generation.mantle.EngineMantle.class);
|
||||
assembly.complex = mock(IrisComplex.class);
|
||||
assembly.effects = mock(EngineEffects.class);
|
||||
assembly.mode = mock(EngineMode.class);
|
||||
assembly.worldManager = mock(EngineWorldManager.class);
|
||||
assembly.hash32 = CompletableFuture.completedFuture(0L);
|
||||
return assembly;
|
||||
}
|
||||
}
|
||||
@@ -858,7 +858,7 @@ public class EngineShutdownDrainTest {
|
||||
when(generation.runtimeKernel()).thenReturn(kernel);
|
||||
GenerationRuntime nextGeneration = generation(target, mantle);
|
||||
when(nextGeneration.complex()).thenReturn(replacement);
|
||||
when(generation.withComplex(anyInt(), same(replacement), isNull(), isNull(), any(), any()))
|
||||
when(generation.withComplex(anyInt(), same(replacement), isNull(), isNull(), any()))
|
||||
.thenReturn(nextGeneration);
|
||||
EngineRuntimeBuilder builder = spy(new EngineRuntimeBuilder(engine));
|
||||
doReturn(new GenerationRuntime.BiomeMaxes(0D, 0D, 0D)).when(builder).computeBiomeMaxes();
|
||||
|
||||
+1
-4
@@ -335,7 +335,6 @@ public class IrisEngineGenerationRuntimeScopeTest {
|
||||
assertSame(detached.dimension, engine.getDimension());
|
||||
assertSame(detached.runtime.seedManager(), engine.getSeedManager());
|
||||
assertSame(detached.complex, engine.getComplex());
|
||||
assertSame(detached.runtime.placementLifecycles(), engine.getPlacementLifecycles());
|
||||
assertSame(detached.upperContext, engine.getUpperContext());
|
||||
assertSame(detached.dimensionStackContext, engine.getDimensionStackContext());
|
||||
assertSame(detached.mode, engine.getMode());
|
||||
@@ -352,7 +351,6 @@ public class IrisEngineGenerationRuntimeScopeTest {
|
||||
assertSame(active.target, engine.getTarget());
|
||||
assertSame(active.data, engine.getData());
|
||||
assertSame(active.runtime.seedManager(), engine.getSeedManager());
|
||||
assertSame(active.runtime.placementLifecycles(), engine.getPlacementLifecycles());
|
||||
assertSame(active.mantle, engine.getMantle());
|
||||
assertEquals(1, engine.getCacheID());
|
||||
}
|
||||
@@ -1011,8 +1009,7 @@ public class IrisEngineGenerationRuntimeScopeTest {
|
||||
mantle,
|
||||
mantleStorageDirectory,
|
||||
hash32,
|
||||
new BiomeMaxes(objectDensity, layerDensity, decoratorDensity),
|
||||
art.arcane.iris.structure.object.PlacementLifecycles.resolve());
|
||||
new BiomeMaxes(objectDensity, layerDensity, decoratorDensity));
|
||||
return new RuntimeFixture(
|
||||
runtime,
|
||||
target,
|
||||
|
||||
+4
-5
@@ -271,7 +271,7 @@ public class IrisObjectPlacementLifecycleRegressionTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void runnerUsesTheEnginePlanAndCompletesTheBlockPassBeforeAfterBlocks() {
|
||||
public void customPlanCompletesTheBlockPassBeforeAfterBlocks() {
|
||||
RecordingPlacer placer = new RecordingPlacer(engine);
|
||||
PlacementLifecycleBuilder builder = new PlacementLifecycleBuilder();
|
||||
ObjectPlaceMode.CENTER_HEIGHT.install(builder);
|
||||
@@ -280,11 +280,10 @@ public class IrisObjectPlacementLifecycleRegressionTest {
|
||||
List<Integer> finishedSizes = new ArrayList<>();
|
||||
builder.add(new PlacementLifecycleDependency("test.finished"), PlacementStage.AFTER_BLOCKS,
|
||||
(context, state, ignored) -> finishedSizes.add(placer.writes().size()));
|
||||
PlacementLifecycles plans = mock(PlacementLifecycles.class);
|
||||
when(plans.get(ObjectPlaceMode.CENTER_HEIGHT)).thenReturn(builder.build());
|
||||
when(engine.getPlacementLifecycles()).thenReturn(plans);
|
||||
PlacementContext context = new PlacementContext(placement(), data, placer, null, new RNG(2L), lineObject(3),
|
||||
0, 0, ANCHOR_Y, null);
|
||||
|
||||
assertEquals(ANCHOR_Y + 5, lineObject(3).place(0, ANCHOR_Y, 0, placer, placement(), new RNG(2L), data));
|
||||
assertEquals(ANCHOR_Y + 5, builder.build().execute(context).heightOrRejected());
|
||||
assertEquals(List.of(3), finishedSizes);
|
||||
assertTrue(placer.writes().stream().allMatch(write -> write.y() == ANCHOR_Y + 5));
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class PlacementLifecycleTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void everyModeResolvesAndRuntimePlansAreIndependent() {
|
||||
public void everyModeResolvesToIndependentPlans() {
|
||||
PlacementLifecycles first = PlacementLifecycles.resolve();
|
||||
PlacementLifecycles second = PlacementLifecycles.resolve();
|
||||
for (ObjectPlaceMode mode : ObjectPlaceMode.values()) {
|
||||
|
||||
Reference in new issue
Block a user