use of org.terasology.engine.core.EngineTime in project Terasology by MovingBlocks.
the class HeadlessEnvironment method setupNetwork.
@Override
protected void setupNetwork() {
EngineTime mockTime = mock(EngineTime.class);
context.put(Time.class, mockTime);
NetworkSystem networkSystem = new NetworkSystemImpl(mockTime, getContext());
context.put(NetworkSystem.class, networkSystem);
}
use of org.terasology.engine.core.EngineTime in project Terasology by MovingBlocks.
the class PrepareWorld method step.
@Override
public boolean step() {
if (worldRenderer.pregenerateChunks()) {
return true;
}
EngineTime time = (EngineTime) context.get(Time.class);
timeElapsed = time.getRealTimeInMs() - startTime;
return timeElapsed > 5000;
}
use of org.terasology.engine.core.EngineTime in project Terasology by MovingBlocks.
the class StateLoading method init.
@Override
public void init(GameEngine engine) {
this.context = engine.createChildContext();
headless = context.get(DisplayDevice.class).isHeadless();
CoreRegistry.setContext(context);
systemConfig = context.get(SystemConfig.class);
if (!headless) {
this.nuiManager = new NUIManagerInternal((TerasologyCanvasRenderer) context.get(CanvasRenderer.class), context);
context.put(NUIManager.class, nuiManager);
}
EngineTime time = (EngineTime) context.get(Time.class);
time.setPaused(true);
time.setGameTime(gameManifest.getTime());
context.get(Game.class).load(gameManifest);
switch(netMode) {
case CLIENT:
initClient();
break;
default:
initHost();
break;
}
progress = 0;
maxProgress = 0;
for (LoadProcess process : loadProcesses) {
maxProgress += process.getExpectedCost();
}
popStep();
if (nuiManager != null) {
loadingScreen = nuiManager.pushScreen("engine:loadingScreen", LoadingScreen.class);
loadingScreen.updateStatus(current.getMessage(), current.getProgress());
}
chunkGenerationStarted = false;
}
use of org.terasology.engine.core.EngineTime in project Terasology by MovingBlocks.
the class StateLoading method onChunkLoaded.
@Override
public void onChunkLoaded(OnChunkLoaded chunkAvailable, EntityRef worldEntity) {
EngineTime time = (EngineTime) context.get(Time.class);
timeLastChunkGenerated = time.getRealTimeInMs();
}
use of org.terasology.engine.core.EngineTime in project Terasology by MovingBlocks.
the class StateLoading method dispose.
@Override
public void dispose(boolean shuttingDown) {
EngineTime time = (EngineTime) context.get(Time.class);
time.setPaused(false);
}
Aggregations