Package org.terasology.world.biomes

Examples of org.terasology.world.biomes.BiomeManager


        CoreRegistry.put(ChunkProvider.class, mock(ChunkProvider.class));

        Game game = mock(Game.class);
        when(game.getTime()).thenReturn(mock(EngineTime.class));
        CoreRegistry.put(Game.class, game);
        BiomeManager biomeManager = mock(BiomeManager.class);
        when(biomeManager.getBiomes()).thenReturn(Collections.<Biome> emptyList());
        CoreRegistry.put(BiomeManager.class, biomeManager);
        WorldProvider worldProvider = mock(WorldProvider.class);
        when(worldProvider.getWorldInfo()).thenReturn(new WorldInfo());
        CoreRegistry.put(WorldProvider.class, worldProvider);
View Full Code Here


        }
    }

    private void addGameManifestToSaveTransaction(SaveTransactionBuilder saveTransactionBuilder) {
        BlockManager blockManager = CoreRegistry.get(BlockManager.class);
        BiomeManager biomeManager = CoreRegistry.get(BiomeManager.class);
        WorldProvider worldProvider = CoreRegistry.get(WorldProvider.class);
        Game game = CoreRegistry.get(Game.class);

        GameManifest gameManifest = new GameManifest(game.getName(), game.getSeed(), game.getTime().getGameTimeInMs());
        for (Module module : CoreRegistry.get(ModuleManager.class).getEnvironment()) {
            gameManifest.addModule(module.getId(), module.getVersion());
        }

        List<String> registeredBlockFamilies = Lists.newArrayList();
        for (BlockFamily family : blockManager.listRegisteredBlockFamilies()) {
            registeredBlockFamilies.add(family.getURI().toString());
        }
        gameManifest.setRegisteredBlockFamilies(registeredBlockFamilies);
        gameManifest.setBlockIdMap(blockManager.getBlockIdMap());
        List<Biome> biomes = biomeManager.getBiomes();
        Map<String, Short> biomeIdMap = new HashMap<>(biomes.size());
        for (Biome biome : biomes) {
            short shortId = biomeManager.getBiomeShortId(biome);
            String id = biomeManager.getBiomeId(biome);
            biomeIdMap.put(id, shortId);
        }
        gameManifest.setBiomeIdMap(biomeIdMap);
        gameManifest.addWorld(worldProvider.getWorldInfo());
        saveTransactionBuilder.setGameManifest(gameManifest);
View Full Code Here

    @Override
    public boolean step() {
        NetworkSystem networkSystem = CoreRegistry.get(NetworkSystem.class);
        ModuleEnvironment moduleEnvironment = CoreRegistry.get(ModuleManager.class).getEnvironment();

        BiomeManager biomeManager;
        if (networkSystem.getMode().isAuthority()) {
            biomeManager = new BiomeManager(moduleEnvironment, gameManifest.getBiomeIdMap());
//            biomeManager.subscribe(CoreRegistry.get(NetworkSystem.class));
            // TODO figure out what this does
        } else {
            biomeManager = new BiomeManager(moduleEnvironment, gameManifest.getBiomeIdMap());
        }
        CoreRegistry.put(BiomeManager.class, biomeManager);
        CoreRegistry.put(BiomeRegistry.class, biomeManager); // This registration is for other modules

        return true;
View Full Code Here

TOP

Related Classes of org.terasology.world.biomes.BiomeManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.