Search in sources :

Example 1 with RemoteChunkProvider

use of org.terasology.engine.world.chunks.remoteChunkProvider.RemoteChunkProvider in project Terasology by MovingBlocks.

the class InitialiseRemoteWorld method step.

@Override
public boolean step() {
    // TODO: These shouldn't be done here, nor so strongly tied to the world renderer
    LocalPlayer localPlayer = new LocalPlayer();
    localPlayer.setRecordAndReplayClasses(context.get(DirectionAndOriginPosRecorderList.class), context.get(RecordAndReplayCurrentStatus.class));
    context.put(LocalPlayer.class, localPlayer);
    BlockManager blockManager = context.get(BlockManager.class);
    ExtraBlockDataManager extraDataManager = context.get(ExtraBlockDataManager.class);
    RemoteChunkProvider chunkProvider = new RemoteChunkProvider(blockManager, localPlayer);
    WorldProviderCoreImpl worldProviderCore = new WorldProviderCoreImpl(gameManifest.getWorldInfo(TerasologyConstants.MAIN_WORLD), chunkProvider, blockManager.getBlock(BlockManager.UNLOADED_ID), context);
    EntityAwareWorldProvider entityWorldProvider = new EntityAwareWorldProvider(worldProviderCore, context);
    WorldProvider worldProvider = new WorldProviderWrapper(entityWorldProvider, extraDataManager);
    context.put(WorldProvider.class, worldProvider);
    context.put(BlockEntityRegistry.class, entityWorldProvider);
    context.get(ComponentSystemManager.class).register(entityWorldProvider, "engine:BlockEntityRegistry");
    DefaultCelestialSystem celestialSystem = new DefaultCelestialSystem(new BasicCelestialModel(), context);
    context.put(CelestialSystem.class, celestialSystem);
    context.get(ComponentSystemManager.class).register(celestialSystem);
    // Init. a new world
    context.put(BackdropProvider.class, new Skysphere(context));
    RenderingSubsystemFactory engineSubsystemFactory = context.get(RenderingSubsystemFactory.class);
    WorldRenderer worldRenderer = engineSubsystemFactory.createWorldRenderer(context);
    float reflectionHeight = context.get(NetworkSystem.class).getServer().getInfo().getReflectionHeight();
    worldRenderer.getActiveCamera().setReflectionHeight(reflectionHeight);
    context.put(WorldRenderer.class, worldRenderer);
    // TODO: These shouldn't be done here, nor so strongly tied to the world renderer
    context.put(Camera.class, worldRenderer.getActiveCamera());
    context.get(NetworkSystem.class).setRemoteWorldProvider(chunkProvider);
    return true;
}
Also used : LocalPlayer(org.terasology.engine.logic.players.LocalPlayer) WorldProviderWrapper(org.terasology.engine.world.internal.WorldProviderWrapper) NetworkSystem(org.terasology.engine.network.NetworkSystem) WorldProviderCoreImpl(org.terasology.engine.world.internal.WorldProviderCoreImpl) ExtraBlockDataManager(org.terasology.engine.world.chunks.blockdata.ExtraBlockDataManager) EntityAwareWorldProvider(org.terasology.engine.world.internal.EntityAwareWorldProvider) DefaultCelestialSystem(org.terasology.engine.world.sun.DefaultCelestialSystem) RenderingSubsystemFactory(org.terasology.engine.core.subsystem.RenderingSubsystemFactory) WorldRenderer(org.terasology.engine.rendering.world.WorldRenderer) ComponentSystemManager(org.terasology.engine.core.ComponentSystemManager) DirectionAndOriginPosRecorderList(org.terasology.engine.recording.DirectionAndOriginPosRecorderList) BasicCelestialModel(org.terasology.engine.world.sun.BasicCelestialModel) BlockManager(org.terasology.engine.world.block.BlockManager) Skysphere(org.terasology.engine.rendering.backdrop.Skysphere) EntityAwareWorldProvider(org.terasology.engine.world.internal.EntityAwareWorldProvider) WorldProvider(org.terasology.engine.world.WorldProvider) RecordAndReplayCurrentStatus(org.terasology.engine.recording.RecordAndReplayCurrentStatus) RemoteChunkProvider(org.terasology.engine.world.chunks.remoteChunkProvider.RemoteChunkProvider)

Aggregations

ComponentSystemManager (org.terasology.engine.core.ComponentSystemManager)1 RenderingSubsystemFactory (org.terasology.engine.core.subsystem.RenderingSubsystemFactory)1 LocalPlayer (org.terasology.engine.logic.players.LocalPlayer)1 NetworkSystem (org.terasology.engine.network.NetworkSystem)1 DirectionAndOriginPosRecorderList (org.terasology.engine.recording.DirectionAndOriginPosRecorderList)1 RecordAndReplayCurrentStatus (org.terasology.engine.recording.RecordAndReplayCurrentStatus)1 Skysphere (org.terasology.engine.rendering.backdrop.Skysphere)1 WorldRenderer (org.terasology.engine.rendering.world.WorldRenderer)1 WorldProvider (org.terasology.engine.world.WorldProvider)1 BlockManager (org.terasology.engine.world.block.BlockManager)1 ExtraBlockDataManager (org.terasology.engine.world.chunks.blockdata.ExtraBlockDataManager)1 RemoteChunkProvider (org.terasology.engine.world.chunks.remoteChunkProvider.RemoteChunkProvider)1 EntityAwareWorldProvider (org.terasology.engine.world.internal.EntityAwareWorldProvider)1 WorldProviderCoreImpl (org.terasology.engine.world.internal.WorldProviderCoreImpl)1 WorldProviderWrapper (org.terasology.engine.world.internal.WorldProviderWrapper)1 BasicCelestialModel (org.terasology.engine.world.sun.BasicCelestialModel)1 DefaultCelestialSystem (org.terasology.engine.world.sun.DefaultCelestialSystem)1