package entity; import org.joml.Vector3d; import org.junit.Before; import org.junit.Test; import electrosphere.engine.Globals; import electrosphere.engine.Main; import electrosphere.entity.types.creature.CreatureUtils; import electrosphere.net.NetUtils; import electrosphere.server.datacell.Realm; import testutils.TestEntityUtils; public class SpawningCreaturesTest { @Before public void initEngine(){ System.out.println("[Test] Spawn many creatures"); Globals.RUN_CLIENT = true; Globals.RUN_SERVER = true; Globals.HEADLESS = true; NetUtils.setPort(0); Main.startUp(); } // @Test // public void testSpawnCreature(){ // System.out.println("[Test] Spawn creature"); // Globals.RUN_CLIENT = false; // Globals.RUN_SERVER = true; // NetUtils.setPort(0); // Main.startUp(); // CreatureUtils.spawnBasicCreature("human", null); // Main.mainLoop(1); // assert TestEntityUtils.numberOfEntitiesInBox(new Vector3d(-1,-1,-1),new Vector3d(1,1,1)) == 1; // } @Test public void testSpawnMultipleCreatures(){ // Realm realm = Globals.realmManager.getRealms().iterator().next(); // for(int i = 0; i < 100; i++){ // CreatureUtils.serverSpawnBasicCreature(realm, new Vector3d(0,0,0), "human", null); // } // Main.mainLoop(1); // assert TestEntityUtils.numberOfEntitiesInBox(new Vector3d(-1,-1,-1),new Vector3d(1,1,1)) == 100; } }