use of org.terasology.engine.network.NetworkSystem in project Terasology by MovingBlocks.
the class OwnershipHelperTest method setup.
@BeforeEach
public void setup() {
ContextImpl context = new ContextImpl();
context.put(ModuleManager.class, moduleManager);
NetworkSystem networkSystem = mock(NetworkSystem.class);
when(networkSystem.getMode()).thenReturn(NetworkMode.NONE);
context.put(NetworkSystem.class, networkSystem);
context.put(RecordAndReplayCurrentStatus.class, new RecordAndReplayCurrentStatus());
CoreRegistry.setContext(context);
EntitySystemSetupUtil.addReflectionBasedLibraries(context);
EntitySystemSetupUtil.addEntityManagementRelatedClasses(context);
entityManager = context.get(EngineEntityManager.class);
}
use of org.terasology.engine.network.NetworkSystem in project Terasology by MovingBlocks.
the class ComponentSerializerTest method setup.
@BeforeEach
public void setup() {
context = new ContextImpl();
context.put(RecordAndReplayCurrentStatus.class, new RecordAndReplayCurrentStatus());
context.put(ModuleManager.class, moduleManager);
CoreRegistry.setContext(context);
Reflections reflections = new Reflections(getClass().getClassLoader());
TypeHandlerLibrary serializationLibrary = new TypeHandlerLibraryImpl(reflections);
serializationLibrary.addTypeHandler(Vector3f.class, new Vector3fTypeHandler());
serializationLibrary.addTypeHandler(Quaternionf.class, new QuaternionfTypeHandler());
NetworkSystem networkSystem = mock(NetworkSystem.class);
when(networkSystem.getMode()).thenReturn(NetworkMode.NONE);
context.put(NetworkSystem.class, networkSystem);
EntitySystemSetupUtil.addReflectionBasedLibraries(context);
EntitySystemSetupUtil.addEntityManagementRelatedClasses(context);
EngineEntityManager entityManager = context.get(EngineEntityManager.class);
entityManager.getComponentLibrary().register(new ResourceUrn("test", "gettersetter"), GetterSetterComponent.class);
entityManager.getComponentLibrary().register(new ResourceUrn("test", "string"), StringComponent.class);
entityManager.getComponentLibrary().register(new ResourceUrn("test", "integer"), IntegerComponent.class);
ComponentLibrary componentLibrary = entityManager.getComponentLibrary();
componentSerializer = new ComponentSerializer(componentLibrary, serializationLibrary);
}
use of org.terasology.engine.network.NetworkSystem in project Terasology by MovingBlocks.
the class PojoEntityPoolTest method setup.
@BeforeEach
public void setup() {
NetworkSystem networkSystem = mock(NetworkSystem.class);
when(networkSystem.getMode()).thenReturn(NetworkMode.NONE);
context.put(NetworkSystem.class, networkSystem);
EntitySystemSetupUtil.addReflectionBasedLibraries(context);
EntitySystemSetupUtil.addEntityManagementRelatedClasses(context);
entityManager = (PojoEntityManager) context.get(EntityManager.class);
pool = new PojoEntityPool(entityManager);
}
use of org.terasology.engine.network.NetworkSystem in project Terasology by MovingBlocks.
the class SetupRemotePlayer method step.
@Override
public boolean step() {
NetworkSystemImpl networkSystem = (NetworkSystemImpl) context.get(NetworkSystem.class);
EntityRef client = networkSystem.getServer().getClientEntity();
if (client.exists()) {
context.get(LocalPlayer.class).setClientEntity(client);
return true;
}
return false;
}
use of org.terasology.engine.network.NetworkSystem in project Terasology by MovingBlocks.
the class GameConfigurationMetric method fetchNetworkMode.
private void fetchNetworkMode() {
NetworkSystem networkSystem = context.get(NetworkSystem.class);
networkMode = networkSystem.getMode().toString();
}
Aggregations