use of org.terasology.world.block.BlockManager in project Terasology by MovingBlocks.
the class ReadWriteStorageManager method addGameManifestToSaveTransaction.
private void addGameManifestToSaveTransaction(SaveTransactionBuilder saveTransactionBuilder) {
BlockManager blockManager = CoreRegistry.get(BlockManager.class);
BiomeManager biomeManager = CoreRegistry.get(BiomeManager.class);
WorldProvider worldProvider = CoreRegistry.get(WorldProvider.class);
Time time = CoreRegistry.get(Time.class);
Game game = CoreRegistry.get(Game.class);
GameManifest gameManifest = new GameManifest(game.getName(), game.getSeed(), time.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);
}
use of org.terasology.world.block.BlockManager in project Terasology by MovingBlocks.
the class FloraRasterizer method initialize.
@Override
public void initialize() {
BlockManager blockManager = CoreRegistry.get(BlockManager.class);
air = blockManager.getBlock(BlockManager.AIR_ID);
flora.put(FloraType.GRASS, ImmutableList.<Block>of(blockManager.getBlock("core:TallGrass1"), blockManager.getBlock("core:TallGrass2"), blockManager.getBlock("core:TallGrass3")));
flora.put(FloraType.FLOWER, ImmutableList.<Block>of(blockManager.getBlock("core:Dandelion"), blockManager.getBlock("core:Glowbell"), blockManager.getBlock("core:Iris"), blockManager.getBlock("core:Lavender"), blockManager.getBlock("core:RedClover"), blockManager.getBlock("core:RedFlower"), blockManager.getBlock("core:Tulip"), blockManager.getBlock("core:YellowFlower")));
flora.put(FloraType.MUSHROOM, ImmutableList.<Block>of(blockManager.getBlock("core:BigBrownShroom"), blockManager.getBlock("core:BrownShroom"), blockManager.getBlock("core:RedShroom")));
}
use of org.terasology.world.block.BlockManager in project Terasology by MovingBlocks.
the class GroundRasterizer method initialize.
@Override
public void initialize() {
BlockManager blockManager = CoreRegistry.get(BlockManager.class);
stone = blockManager.getBlock("core:stone");
water = blockManager.getBlock("core:water");
}
use of org.terasology.world.block.BlockManager in project Terasology by MovingBlocks.
the class SolidRasterizer method initialize.
@Override
public void initialize() {
BlockManager blockManager = CoreRegistry.get(BlockManager.class);
stone = blockManager.getBlock("core:stone");
water = blockManager.getBlock("core:water");
ice = blockManager.getBlock("core:Ice");
sand = blockManager.getBlock("core:Sand");
grass = blockManager.getBlock("core:Grass");
snow = blockManager.getBlock("core:Snow");
dirt = blockManager.getBlock("core:Dirt");
}
use of org.terasology.world.block.BlockManager in project Terasology by MovingBlocks.
the class TreeTests method setup.
@Before
public void setup() {
ContextImpl context = new ContextImpl();
CoreRegistry.setContext(context);
// Needed only as long as #1536 is unresolved
context.put(Config.class, new Config(new MockContext()));
blockManager = Mockito.mock(BlockManager.class);
Block air = blockManager.getBlock(BlockManager.AIR_ID);
biomeManager = Mockito.mock(BiomeManager.class);
Mockito.when(blockManager.getBlock(Matchers.<BlockUri>any())).thenReturn(air);
Mockito.when(blockManager.getBlock(Matchers.<String>any())).thenReturn(air);
context.put(BlockManager.class, blockManager);
}
Aggregations