use of org.spongepowered.common.world.biome.SpongeBiomeGenerationSettings in project SpongeCommon by SpongePowered.
the class MixinBiome method createDefaultGenerationSettings.
@Override
public BiomeGenerationSettings createDefaultGenerationSettings(org.spongepowered.api.world.World world) {
SpongeBiomeGenerationSettings gensettings = new SpongeBiomeGenerationSettings();
gensettings.getPopulators().clear();
gensettings.getGenerationPopulators().clear();
gensettings.getGroundCoverLayers().clear();
buildPopulators((World) world, gensettings);
if (!getClass().getName().startsWith("net.minecraft")) {
gensettings.getPopulators().add(new WrappedBiomeDecorator((Biome) (Object) this));
} else if (!this.decorator.getClass().getName().startsWith("net.minecraft")) {
gensettings.getPopulators().add(new WrappedBiomeDecorator(this.decorator));
}
return gensettings;
}
use of org.spongepowered.common.world.biome.SpongeBiomeGenerationSettings in project SpongeCommon by SpongePowered.
the class MixinBiomeHills method buildPopulators.
@Override
public void buildPopulators(World world, SpongeBiomeGenerationSettings gensettings) {
super.buildPopulators(world, gensettings);
gensettings.getGroundCoverLayers().clear();
gensettings.getGroundCoverLayers().add(new GroundCoverLayer((stoneNoise) -> {
IBlockState result = Blocks.GRASS.getDefaultState();
if ((stoneNoise < -1.0D || stoneNoise > 2.0D) && this.type == BiomeHills.Type.MUTATED) {
result = Blocks.GRAVEL.getDefaultState();
} else if (stoneNoise > 1.0D && this.type != BiomeHills.Type.EXTRA_TREES) {
result = Blocks.STONE.getDefaultState();
}
return (BlockState) result;
}, SeededVariableAmount.fixed(1)));
gensettings.getGroundCoverLayers().add(new GroundCoverLayer((stoneNoise) -> {
IBlockState result = Blocks.DIRT.getDefaultState();
if ((stoneNoise < -1.0D || stoneNoise > 2.0D) && this.type == BiomeHills.Type.MUTATED) {
result = Blocks.GRAVEL.getDefaultState();
} else if (stoneNoise > 1.0D && this.type != BiomeHills.Type.EXTRA_TREES) {
result = Blocks.STONE.getDefaultState();
}
return (BlockState) result;
}, WorldGenConstants.GROUND_COVER_DEPTH));
BiomeDecorator theBiomeDecorator = this.decorator;
RandomBlock emerald = RandomBlock.builder().block((BlockState) Blocks.EMERALD_ORE.getDefaultState()).placementTarget(WorldGenConstants.STONE_LOCATION).perChunk(VariableAmount.baseWithRandomAddition(3, 6)).height(VariableAmount.baseWithRandomAddition(4, 28)).build();
gensettings.getPopulators().add(emerald);
Ore silverfish = Ore.builder().ore((BlockState) Blocks.MONSTER_EGG.getDefaultState().withProperty(BlockSilverfish.VARIANT, BlockSilverfish.EnumType.STONE)).perChunk(7).height(VariableAmount.baseWithRandomAddition(0, 64)).size(9).build();
gensettings.getPopulators().add(silverfish);
gensettings.getPopulators().removeAll(gensettings.getPopulators(Forest.class));
Forest.Builder forest = Forest.builder();
forest.perChunk(VariableAmount.baseWithOptionalAddition(theBiomeDecorator.treesPerChunk, 1, 0.1));
forest.type(BiomeTreeTypes.TALL_TAIGA.getPopulatorObject(), 20);
forest.type(BiomeTreeTypes.OAK.getPopulatorObject(), 9);
forest.type(BiomeTreeTypes.OAK.getLargePopulatorObject().get(), 1);
gensettings.getPopulators().add(0, forest.build());
}
use of org.spongepowered.common.world.biome.SpongeBiomeGenerationSettings in project SpongeCommon by SpongePowered.
the class SpongeChunkGenerator method getBiomeSettings.
@Override
public BiomeGenerationSettings getBiomeSettings(BiomeType type) {
checkNotNull(type, "type");
BiomeGenerationSettings settings = this.biomeSettings.get(type);
if (settings == null) {
if (SpongeGenerationPopulator.class.isInstance(this.baseGenerator)) {
// If the base generator was mod provided then we assume that it
// will handle its own
// generation so we don't add the base game's generation
settings = new SpongeBiomeGenerationSettings();
} else {
settings = type.createDefaultGenerationSettings((org.spongepowered.api.world.World) this.world);
}
this.biomeSettings.put(type, settings);
}
return settings;
}
use of org.spongepowered.common.world.biome.SpongeBiomeGenerationSettings in project SpongeCommon by SpongePowered.
the class SpongeWorldGenerator method getBiomeSettings.
@Override
public BiomeGenerationSettings getBiomeSettings(BiomeType type) {
checkNotNull(type);
BiomeGenerationSettings settings = this.biomeSettings.get(type);
if (settings == null) {
if (SpongeGenerationPopulator.class.isInstance(this.baseGenerator)) {
// If the base generator was mod provided then we assume that it will handle its own
// generation so we don't add the base game's generation
settings = new SpongeBiomeGenerationSettings();
} else {
settings = type.createDefaultGenerationSettings((org.spongepowered.api.world.World) this.world);
}
this.biomeSettings.put(type, settings);
}
return settings;
}
Aggregations