mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-12-01 18:24:06 +00:00
Register the spawn module in the spawner tests
The spawner tests ask the running world for saved state, which now needs the key to be registered, so their pack serves SpawnModule.
This commit is contained in:
1 parent
0b5b0190f5
commit
88fe8c8bcd
2 files changed
+12
-2
No files matched your search
@@ -82,6 +82,7 @@ public class EntitySpawningTest {
|
|||||||
IrisData data = mock(IrisData.class);
|
IrisData data = mock(IrisData.class);
|
||||||
when(engine.getData()).thenReturn(data);
|
when(engine.getData()).thenReturn(data);
|
||||||
fixture = ModuleResourceFixture.serve(data);
|
fixture = ModuleResourceFixture.serve(data);
|
||||||
|
ModuleResourceFixture.serveModules(data, new SpawnModule());
|
||||||
when(data.getPackResources().items()).thenReturn(mock(ItemRegistry.class));
|
when(data.getPackResources().items()).thenReturn(mock(ItemRegistry.class));
|
||||||
IrisWorld engineWorld = mock(IrisWorld.class);
|
IrisWorld engineWorld = mock(IrisWorld.class);
|
||||||
when(engineWorld.platformWorld()).thenReturn(mock(PlatformWorld.class));
|
when(engineWorld.platformWorld()).thenReturn(mock(PlatformWorld.class));
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ package art.arcane.iris.engine.spawn;
|
|||||||
|
|
||||||
import art.arcane.iris.builtin.spawn.Spawner;
|
import art.arcane.iris.builtin.spawn.Spawner;
|
||||||
import art.arcane.iris.core.loader.IrisData;
|
import art.arcane.iris.core.loader.IrisData;
|
||||||
|
import art.arcane.iris.core.modules.ModuleResourceFixture;
|
||||||
import art.arcane.iris.engine.framework.Engine;
|
import art.arcane.iris.engine.framework.Engine;
|
||||||
import art.arcane.iris.engine.framework.EngineGeneration;
|
import art.arcane.iris.engine.framework.EngineGeneration;
|
||||||
import art.arcane.iris.engine.object.TestSettings;
|
import art.arcane.iris.engine.object.TestSettings;
|
||||||
@@ -45,6 +46,12 @@ public class SpawnerGateTest {
|
|||||||
private Engine engine;
|
private Engine engine;
|
||||||
private SpawnerGate gate;
|
private SpawnerGate gate;
|
||||||
|
|
||||||
|
private static IrisData dataWithSpawnModule() {
|
||||||
|
IrisData data = mock(IrisData.class);
|
||||||
|
ModuleResourceFixture.serveModules(data, new SpawnModule());
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void buildEngine() {
|
public void buildEngine() {
|
||||||
engine = mock(Engine.class);
|
engine = mock(Engine.class);
|
||||||
@@ -54,7 +61,8 @@ public class SpawnerGateTest {
|
|||||||
when(engineWorld.platformWorld()).thenReturn(platformWorld);
|
when(engineWorld.platformWorld()).thenReturn(platformWorld);
|
||||||
when(engineWorld.worldFolder()).thenReturn(worldFolder.getRoot());
|
when(engineWorld.worldFolder()).thenReturn(worldFolder.getRoot());
|
||||||
when(engine.getWorld()).thenReturn(engineWorld);
|
when(engine.getWorld()).thenReturn(engineWorld);
|
||||||
when(engine.getData()).thenReturn(mock(IrisData.class));
|
IrisData spawnData = dataWithSpawnModule();
|
||||||
|
when(engine.getData()).thenReturn(spawnData);
|
||||||
gate = SpawnerGate.of(new EngineGeneration(engine).world());
|
gate = SpawnerGate.of(new EngineGeneration(engine).world());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,7 +130,8 @@ public class SpawnerGateTest {
|
|||||||
Engine engine = mock(Engine.class);
|
Engine engine = mock(Engine.class);
|
||||||
IrisWorld engineWorld = mock(IrisWorld.class);
|
IrisWorld engineWorld = mock(IrisWorld.class);
|
||||||
when(engineWorld.worldFolder()).thenReturn(worldFolder.getRoot());
|
when(engineWorld.worldFolder()).thenReturn(worldFolder.getRoot());
|
||||||
when(engine.getData()).thenReturn(mock(IrisData.class));
|
IrisData spawnData = dataWithSpawnModule();
|
||||||
|
when(engine.getData()).thenReturn(spawnData);
|
||||||
when(engine.getWorld()).thenReturn(engineWorld);
|
when(engine.getWorld()).thenReturn(engineWorld);
|
||||||
|
|
||||||
assertFalse(SpawnerGate.of(new EngineGeneration(engine).world()).canSpawn("any", spawner("{}"), 0, 0));
|
assertFalse(SpawnerGate.of(new EngineGeneration(engine).world()).canSpawn("any", spawner("{}"), 0, 0));
|
||||||
|
|||||||
Reference in new issue
Block a user