Search in sources :

Example 1 with RemoteChunkProvider

use of org.terasology.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();
    context.put(LocalPlayer.class, localPlayer);
    BlockManager blockManager = context.get(BlockManager.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);
    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
    Skysphere skysphere = new Skysphere(context);
    BackdropProvider backdropProvider = skysphere;
    BackdropRenderer backdropRenderer = skysphere;
    context.put(BackdropProvider.class, backdropProvider);
    context.put(BackdropRenderer.class, backdropRenderer);
    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.logic.players.LocalPlayer) WorldProviderWrapper(org.terasology.world.internal.WorldProviderWrapper) NetworkSystem(org.terasology.network.NetworkSystem) WorldProviderCoreImpl(org.terasology.world.internal.WorldProviderCoreImpl) EntityAwareWorldProvider(org.terasology.world.internal.EntityAwareWorldProvider) DefaultCelestialSystem(org.terasology.world.sun.DefaultCelestialSystem) BackdropProvider(org.terasology.rendering.backdrop.BackdropProvider) RenderingSubsystemFactory(org.terasology.engine.subsystem.RenderingSubsystemFactory) WorldRenderer(org.terasology.rendering.world.WorldRenderer) ComponentSystemManager(org.terasology.engine.ComponentSystemManager) BasicCelestialModel(org.terasology.world.sun.BasicCelestialModel) BlockManager(org.terasology.world.block.BlockManager) Skysphere(org.terasology.rendering.backdrop.Skysphere) WorldProvider(org.terasology.world.WorldProvider) EntityAwareWorldProvider(org.terasology.world.internal.EntityAwareWorldProvider) RemoteChunkProvider(org.terasology.world.chunks.remoteChunkProvider.RemoteChunkProvider) BackdropRenderer(org.terasology.rendering.backdrop.BackdropRenderer)

Aggregations

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