Search in sources :

Example 1 with GameState

use of org.terasology.engine.core.modes.GameState in project Terasology by MovingBlocks.

the class LoadingChunkEventSystem method onNewChunk.

/**
 * Event handler which waits for new chunk events, then sends those
 * events to the current game state
 * @param chunkAvailable an event which includes the position of the new chunk
 * @param worldEntity the world entity that this event was sent to
 */
@ReceiveEvent(components = WorldComponent.class)
public void onNewChunk(OnChunkLoaded chunkAvailable, EntityRef worldEntity) {
    GameEngine gameEngine = context.get(GameEngine.class);
    GameState gameState = gameEngine.getState();
    gameState.onChunkLoaded(chunkAvailable, worldEntity);
}
Also used : GameEngine(org.terasology.engine.core.GameEngine) GameState(org.terasology.engine.core.modes.GameState) ReceiveEvent(org.terasology.engine.entitySystem.event.ReceiveEvent)

Example 2 with GameState

use of org.terasology.engine.core.modes.GameState in project Terasology by MovingBlocks.

the class SceneProperties method getProperties.

@Override
public List<Property<?>> getProperties() {
    List<Property<?>> result = Lists.newArrayList();
    GameState gameState = engine.getState();
    if (!(gameState instanceof StateIngame)) {
        return result;
    }
    StateIngame ingameState = (StateIngame) gameState;
    Context ingameContext = ingameState.getContext();
    BackdropProvider backdropProvider = ingameContext.get(BackdropProvider.class);
    if (backdropProvider != null) {
        result.addAll(new ReflectionProvider(backdropProvider, ingameContext).getProperties());
    }
    /*FrameBuffersManager renderingProcess = ingameContext.get(FrameBuffersManager.class);
        if (renderingProcess != null) {
            result.addAll(new ReflectionProvider(renderingProcess, ingameContext).getProperties());
        }*/
    return result;
}
Also used : Context(org.terasology.engine.context.Context) StateIngame(org.terasology.engine.core.modes.StateIngame) GameState(org.terasology.engine.core.modes.GameState) BackdropProvider(org.terasology.engine.rendering.backdrop.BackdropProvider)

Aggregations

GameState (org.terasology.engine.core.modes.GameState)2 Context (org.terasology.engine.context.Context)1 GameEngine (org.terasology.engine.core.GameEngine)1 StateIngame (org.terasology.engine.core.modes.StateIngame)1 ReceiveEvent (org.terasology.engine.entitySystem.event.ReceiveEvent)1 BackdropProvider (org.terasology.engine.rendering.backdrop.BackdropProvider)1