use of org.spongepowered.api.world.gen.populator.Ore in project SpongeCommon by SpongePowered.
the class MixinBiomeMesa method buildPopulators.
@Override
public void buildPopulators(World world, SpongeBiomeGenerationSettings gensettings) {
gensettings.getGenerationPopulators().add(new MesaBiomeGenerationPopulator(this.brycePillars, this.hasForest));
super.buildPopulators(world, gensettings);
String s = world.getWorldInfo().getGeneratorOptions();
ChunkGeneratorSettings settings;
if (s != null) {
settings = ChunkGeneratorSettings.Factory.jsonToFactory(s).build();
} else {
settings = ChunkGeneratorSettings.Factory.jsonToFactory("").build();
}
// Extra gold is generated in mesa biomes
Ore gold = Ore.builder().ore((BlockState) Blocks.GOLD_ORE.getDefaultState()).size(settings.goldSize).perChunk(20).height(VariableAmount.baseWithRandomAddition(32, 80 - 32)).build();
gensettings.getPopulators().add(gold);
BiomeDecorator theBiomeDecorator = this.decorator;
gensettings.getGroundCoverLayers().clear();
gensettings.getPopulators().removeAll(gensettings.getPopulators(Forest.class));
Forest.Builder forest = Forest.builder();
forest.perChunk(VariableAmount.baseWithOptionalAddition(theBiomeDecorator.treesPerChunk, 1, 0.1));
forest.type(BiomeTreeTypes.OAK.getPopulatorObject(), 1);
gensettings.getPopulators().add(0, forest.build());
gensettings.getPopulators().removeAll(gensettings.getPopulators(Cactus.class));
Cactus cactus = Cactus.builder().cactiPerChunk(VariableAmount.baseWithOptionalAddition(0, VariableAmount.baseWithRandomAddition(1, VariableAmount.baseWithOptionalAddition(2, 3, 0.25)), 0.4)).build();
gensettings.getPopulators().add(cactus);
}
use of org.spongepowered.api.world.gen.populator.Ore in project SpongeForge by SpongePowered.
the class SpongeChunkGeneratorForge method checkForgeEvent.
private boolean checkForgeEvent(Populator populator, IChunkGenerator chunkProvider, int chunkX, int chunkZ, List<String> flags, Chunk chunk) {
boolean village_flag = flags.contains(WorldGenConstants.VILLAGE_FLAG);
if (populator instanceof Ore && populator instanceof WorldGenerator) {
BlockType type = ((Ore) populator).getOreBlock().getType();
GenerateMinable.EventType otype = null;
if (type.equals(BlockTypes.DIRT)) {
otype = GenerateMinable.EventType.DIRT;
} else if (type.equals(BlockTypes.GRAVEL)) {
otype = GenerateMinable.EventType.GRAVEL;
} else if (type.equals(BlockTypes.STONE)) {
BlockState state = ((Ore) populator).getOreBlock();
Optional<StoneType> stype;
if ((stype = state.get(Keys.STONE_TYPE)).isPresent()) {
StoneType stoneType = stype.get();
if (stoneType.equals(StoneTypes.DIORITE)) {
otype = GenerateMinable.EventType.DIORITE;
} else if (stoneType.equals(StoneTypes.ANDESITE)) {
otype = GenerateMinable.EventType.ANDESITE;
} else if (stoneType.equals(StoneTypes.GRANITE)) {
otype = GenerateMinable.EventType.GRANITE;
} else {
return true;
}
}
} else if (type.equals(BlockTypes.COAL_ORE)) {
otype = GenerateMinable.EventType.COAL;
} else if (type.equals(BlockTypes.IRON_ORE)) {
otype = GenerateMinable.EventType.IRON;
} else if (type.equals(BlockTypes.GOLD_ORE)) {
otype = GenerateMinable.EventType.GOLD;
} else if (type.equals(BlockTypes.REDSTONE_ORE)) {
otype = GenerateMinable.EventType.REDSTONE;
} else if (type.equals(BlockTypes.DIAMOND_ORE)) {
otype = GenerateMinable.EventType.DIAMOND;
} else if (type.equals(BlockTypes.LAPIS_ORE)) {
otype = GenerateMinable.EventType.LAPIS;
} else if (type.equals(BlockTypes.QUARTZ_ORE)) {
otype = GenerateMinable.EventType.QUARTZ;
} else if (type.equals(BlockTypes.EMERALD_ORE)) {
otype = GenerateMinable.EventType.EMERALD;
} else if (type.equals(BlockTypes.MONSTER_EGG)) {
otype = GenerateMinable.EventType.SILVERFISH;
}
return otype == null || TerrainGen.generateOre((World) chunk.getWorld(), this.rand, (WorldGenerator) populator, VecHelper.toBlockPos(chunk.getBlockMin()), otype);
}
Populate.EventType etype = this.getForgeEventTypeForPopulator(populator, chunk);
boolean populate = TerrainGen.populate(chunkProvider, (net.minecraft.world.World) chunk.getWorld(), this.rand, chunkX, chunkZ, village_flag, etype);
Decorate.EventType detype = this.getForgeDecorateEventTypeForPopulator(populator, chunk);
boolean decorate = TerrainGen.decorate((World) chunk.getWorld(), this.rand, VecHelper.toBlockPos(chunk.getBlockMin()), detype);
// TODO May need to separate this..
return populate && decorate;
}
Aggregations