Search in sources :

Example 1 with SpongeBiomeGenerationSettings

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;
}
Also used : IMixinBiome(org.spongepowered.common.interfaces.world.biome.IMixinBiome) Biome(net.minecraft.world.biome.Biome) WrappedBiomeDecorator(org.spongepowered.common.world.gen.populators.WrappedBiomeDecorator) SpongeBiomeGenerationSettings(org.spongepowered.common.world.biome.SpongeBiomeGenerationSettings)

Example 2 with SpongeBiomeGenerationSettings

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());
}
Also used : WorldGenConstants(org.spongepowered.common.world.gen.WorldGenConstants) BiomeHills(net.minecraft.world.biome.BiomeHills) Blocks(net.minecraft.init.Blocks) SpongeBiomeGenerationSettings(org.spongepowered.common.world.biome.SpongeBiomeGenerationSettings) BiomeTreeTypes(org.spongepowered.api.world.gen.type.BiomeTreeTypes) World(net.minecraft.world.World) BiomeDecorator(net.minecraft.world.biome.BiomeDecorator) Forest(org.spongepowered.api.world.gen.populator.Forest) GroundCoverLayer(org.spongepowered.api.world.biome.GroundCoverLayer) SeededVariableAmount(org.spongepowered.api.util.weighted.SeededVariableAmount) VariableAmount(org.spongepowered.api.util.weighted.VariableAmount) Final(org.spongepowered.asm.mixin.Final) BlockState(org.spongepowered.api.block.BlockState) IBlockState(net.minecraft.block.state.IBlockState) Ore(org.spongepowered.api.world.gen.populator.Ore) Mixin(org.spongepowered.asm.mixin.Mixin) RandomBlock(org.spongepowered.api.world.gen.populator.RandomBlock) Shadow(org.spongepowered.asm.mixin.Shadow) BlockSilverfish(net.minecraft.block.BlockSilverfish) RandomBlock(org.spongepowered.api.world.gen.populator.RandomBlock) IBlockState(net.minecraft.block.state.IBlockState) Ore(org.spongepowered.api.world.gen.populator.Ore) Forest(org.spongepowered.api.world.gen.populator.Forest) GroundCoverLayer(org.spongepowered.api.world.biome.GroundCoverLayer) BiomeDecorator(net.minecraft.world.biome.BiomeDecorator)

Example 3 with SpongeBiomeGenerationSettings

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;
}
Also used : BiomeGenerationSettings(org.spongepowered.api.world.biome.BiomeGenerationSettings) SpongeBiomeGenerationSettings(org.spongepowered.common.world.biome.SpongeBiomeGenerationSettings) World(net.minecraft.world.World) SpongeBiomeGenerationSettings(org.spongepowered.common.world.biome.SpongeBiomeGenerationSettings)

Example 4 with SpongeBiomeGenerationSettings

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;
}
Also used : SpongeBiomeGenerationSettings(org.spongepowered.common.world.biome.SpongeBiomeGenerationSettings) BiomeGenerationSettings(org.spongepowered.api.world.biome.BiomeGenerationSettings) World(net.minecraft.world.World) SpongeBiomeGenerationSettings(org.spongepowered.common.world.biome.SpongeBiomeGenerationSettings)

Aggregations

SpongeBiomeGenerationSettings (org.spongepowered.common.world.biome.SpongeBiomeGenerationSettings)4 World (net.minecraft.world.World)3 BiomeGenerationSettings (org.spongepowered.api.world.biome.BiomeGenerationSettings)2 BlockSilverfish (net.minecraft.block.BlockSilverfish)1 IBlockState (net.minecraft.block.state.IBlockState)1 Blocks (net.minecraft.init.Blocks)1 Biome (net.minecraft.world.biome.Biome)1 BiomeDecorator (net.minecraft.world.biome.BiomeDecorator)1 BiomeHills (net.minecraft.world.biome.BiomeHills)1 BlockState (org.spongepowered.api.block.BlockState)1 SeededVariableAmount (org.spongepowered.api.util.weighted.SeededVariableAmount)1 VariableAmount (org.spongepowered.api.util.weighted.VariableAmount)1 GroundCoverLayer (org.spongepowered.api.world.biome.GroundCoverLayer)1 Forest (org.spongepowered.api.world.gen.populator.Forest)1 Ore (org.spongepowered.api.world.gen.populator.Ore)1 RandomBlock (org.spongepowered.api.world.gen.populator.RandomBlock)1 BiomeTreeTypes (org.spongepowered.api.world.gen.type.BiomeTreeTypes)1 Final (org.spongepowered.asm.mixin.Final)1 Mixin (org.spongepowered.asm.mixin.Mixin)1 Shadow (org.spongepowered.asm.mixin.Shadow)1