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;
}
Aggregations