use of org.spongepowered.common.world.gen.populators.FilteredPopulator in project SpongeCommon by SpongePowered.
the class MixinChunkGeneratorFlat method addPopulators.
@Override
public void addPopulators(WorldGenerator generator) {
for (Object o : this.structureGenerators.values()) {
if (o instanceof MapGenBase) {
generator.getGenerationPopulators().add((GenerationPopulator) o);
if (o instanceof MapGenStructure) {
generator.getPopulators().add((Populator) o);
}
}
}
if (this.flatWorldGenInfo.getWorldFeatures().containsKey("lake")) {
Lake lake = Lake.builder().chance(1 / 4d).liquidType((BlockState) Blocks.WATER.getDefaultState()).height(VariableAmount.baseWithRandomAddition(0, 256)).build();
FilteredPopulator filtered = new FilteredPopulator(lake);
filtered.setRequiredFlags(WorldGenConstants.VILLAGE_FLAG);
generator.getPopulators().add(lake);
}
if (this.flatWorldGenInfo.getWorldFeatures().containsKey("lava_lake")) {
Lake lake = Lake.builder().chance(1 / 8d).liquidType((BlockState) Blocks.WATER.getDefaultState()).height(VariableAmount.baseWithVariance(0, VariableAmount.baseWithRandomAddition(8, VariableAmount.baseWithOptionalAddition(55, 193, 0.1)))).build();
FilteredPopulator filtered = new FilteredPopulator(lake);
filtered.setRequiredFlags(WorldGenConstants.VILLAGE_FLAG);
generator.getPopulators().add(filtered);
}
if (this.hasDungeons) {
Dungeon dungeon = Dungeon.builder().attempts(8).build();
generator.getPopulators().add(dungeon);
}
for (BiomeType type : Sponge.getRegistry().getAllOf(BiomeType.class)) {
BiomeGenerationSettings settings = generator.getBiomeSettings(type);
settings.getGroundCoverLayers().clear();
if (!this.hasDecoration) {
settings.getPopulators().clear();
settings.getGenerationPopulators().clear();
}
}
}
use of org.spongepowered.common.world.gen.populators.FilteredPopulator in project SpongeCommon by SpongePowered.
the class MixinChunkGeneratorOverworld method addPopulators.
@Override
public void addPopulators(WorldGenerator generator) {
if (this.settings.useCaves) {
generator.getGenerationPopulators().add((GenerationPopulator) this.caveGenerator);
}
if (this.settings.useRavines) {
generator.getGenerationPopulators().add((GenerationPopulator) this.ravineGenerator);
}
if (this.settings.useMineShafts && this.mapFeaturesEnabled) {
generator.getGenerationPopulators().add((GenerationPopulator) this.mineshaftGenerator);
generator.getPopulators().add((Populator) this.mineshaftGenerator);
}
if (this.settings.useVillages && this.mapFeaturesEnabled) {
generator.getGenerationPopulators().add((GenerationPopulator) this.villageGenerator);
generator.getPopulators().add((Populator) this.villageGenerator);
}
if (this.settings.useStrongholds && this.mapFeaturesEnabled) {
generator.getGenerationPopulators().add((GenerationPopulator) this.strongholdGenerator);
generator.getPopulators().add((Populator) this.strongholdGenerator);
}
if (this.settings.useTemples && this.mapFeaturesEnabled) {
generator.getGenerationPopulators().add((GenerationPopulator) this.scatteredFeatureGenerator);
generator.getPopulators().add((Populator) this.scatteredFeatureGenerator);
}
if (this.settings.useMonuments && this.mapFeaturesEnabled) {
generator.getGenerationPopulators().add((GenerationPopulator) this.oceanMonumentGenerator);
generator.getPopulators().add((Populator) this.oceanMonumentGenerator);
}
if (this.settings.useMansions && this.mapFeaturesEnabled) {
generator.getGenerationPopulators().add((GenerationPopulator) this.woodlandMansionGenerator);
generator.getPopulators().add((Populator) this.woodlandMansionGenerator);
}
if (this.settings.useWaterLakes) {
Lake lake = Lake.builder().chance(1d / this.settings.waterLakeChance).liquidType((BlockState) Blocks.WATER.getDefaultState()).height(VariableAmount.baseWithRandomAddition(0, 256)).build();
FilteredPopulator filtered = new FilteredPopulator(lake, (c) -> {
Biome biomegenbase = this.world.getBiome(VecHelper.toBlockPos(c.getBlockMin()).add(16, 0, 16));
return biomegenbase != Biomes.DESERT && biomegenbase != Biomes.DESERT_HILLS;
});
filtered.setRequiredFlags(WorldGenConstants.VILLAGE_FLAG);
generator.getPopulators().add(filtered);
}
if (this.settings.useLavaLakes) {
Lake lake = Lake.builder().chance(1d / this.settings.lavaLakeChance).liquidType((BlockState) Blocks.WATER.getDefaultState()).height(VariableAmount.baseWithVariance(0, VariableAmount.baseWithRandomAddition(8, VariableAmount.baseWithOptionalAddition(55, 193, 0.1)))).build();
FilteredPopulator filtered = new FilteredPopulator(lake);
filtered.setRequiredFlags(WorldGenConstants.VILLAGE_FLAG);
generator.getPopulators().add(filtered);
}
if (this.settings.useDungeons) {
Dungeon dungeon = Dungeon.builder().attempts(this.settings.dungeonChance).build();
generator.getPopulators().add(dungeon);
}
generator.getPopulators().add(new AnimalPopulator());
generator.getPopulators().add(new SnowPopulator());
}
Aggregations