Search in sources :

Example 1 with BiomeDecorator

use of net.minecraft.world.biome.BiomeDecorator in project Realistic-Terrain-Generation by Team-RTG.

the class BiomeDecoratorRTG method decorateOres.

/*
     * This method should only be called by ChunkProviderRTG#generateOres.
     */
public void decorateOres(World worldIn, Random random, int worldX, int worldZ) {
    //Logger.debug("Started generating ores in %s (%d %d)", this.biome.getBiomeName(), worldX, worldZ);
    BiomeDecorator biomeDecorator = biome.theBiomeDecorator;
    if (biomeDecorator.chunkProviderSettings == null) {
        String generatorOptions = worldIn.getWorldInfo().getGeneratorOptions();
        generatorOptions = (generatorOptions != null) ? generatorOptions : "";
        biomeDecorator.chunkProviderSettings = ChunkProviderSettings.Factory.jsonToFactory(generatorOptions).build();
    }
    // This local variable has to be declared/initialised AFTER the chunk provider settings have been built.
    ChunkProviderSettings chunkProviderSettings = biomeDecorator.chunkProviderSettings;
    pos = new BlockPos(worldX, 0, worldZ);
    biomeDecorator.dirtGen = new WorldGenMinable(Blocks.DIRT.getDefaultState(), chunkProviderSettings.dirtSize);
    biomeDecorator.gravelGen = new WorldGenMinable(Blocks.GRAVEL.getDefaultState(), chunkProviderSettings.gravelSize);
    biomeDecorator.graniteGen = new WorldGenMinable(Blocks.STONE.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.GRANITE), chunkProviderSettings.graniteSize);
    biomeDecorator.dioriteGen = new WorldGenMinable(Blocks.STONE.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.DIORITE), chunkProviderSettings.dioriteSize);
    biomeDecorator.andesiteGen = new WorldGenMinable(Blocks.STONE.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.ANDESITE), chunkProviderSettings.andesiteSize);
    biomeDecorator.coalGen = new WorldGenMinable(Blocks.COAL_ORE.getDefaultState(), chunkProviderSettings.coalSize);
    biomeDecorator.ironGen = new WorldGenMinable(Blocks.IRON_ORE.getDefaultState(), chunkProviderSettings.ironSize);
    biomeDecorator.goldGen = new WorldGenMinable(Blocks.GOLD_ORE.getDefaultState(), chunkProviderSettings.goldSize);
    biomeDecorator.redstoneGen = new WorldGenMinable(Blocks.REDSTONE_ORE.getDefaultState(), chunkProviderSettings.redstoneSize);
    biomeDecorator.diamondGen = new WorldGenMinable(Blocks.DIAMOND_ORE.getDefaultState(), chunkProviderSettings.diamondSize);
    biomeDecorator.lapisGen = new WorldGenMinable(Blocks.LAPIS_ORE.getDefaultState(), chunkProviderSettings.lapisSize);
    MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Pre(worldIn, random, pos));
    if (TerrainGen.generateOre(worldIn, random, biomeDecorator.dirtGen, pos, OreGenEvent.GenerateMinable.EventType.DIRT)) {
        this.genStandardOre1(worldIn, random, chunkProviderSettings.dirtCount, biomeDecorator.dirtGen, chunkProviderSettings.dirtMinHeight, chunkProviderSettings.dirtMaxHeight);
    }
    if (TerrainGen.generateOre(worldIn, random, biomeDecorator.gravelGen, pos, OreGenEvent.GenerateMinable.EventType.GRAVEL)) {
        this.genStandardOre1(worldIn, random, chunkProviderSettings.gravelCount, biomeDecorator.gravelGen, chunkProviderSettings.gravelMinHeight, chunkProviderSettings.gravelMaxHeight);
    }
    if (TerrainGen.generateOre(worldIn, random, biomeDecorator.dioriteGen, pos, OreGenEvent.GenerateMinable.EventType.DIORITE)) {
        this.genStandardOre1(worldIn, random, chunkProviderSettings.dioriteCount, biomeDecorator.dioriteGen, chunkProviderSettings.dioriteMinHeight, chunkProviderSettings.dioriteMaxHeight);
    }
    if (TerrainGen.generateOre(worldIn, random, biomeDecorator.graniteGen, pos, OreGenEvent.GenerateMinable.EventType.GRANITE)) {
        this.genStandardOre1(worldIn, random, chunkProviderSettings.graniteCount, biomeDecorator.graniteGen, chunkProviderSettings.graniteMinHeight, chunkProviderSettings.graniteMaxHeight);
    }
    if (TerrainGen.generateOre(worldIn, random, biomeDecorator.andesiteGen, pos, OreGenEvent.GenerateMinable.EventType.ANDESITE)) {
        this.genStandardOre1(worldIn, random, chunkProviderSettings.andesiteCount, biomeDecorator.andesiteGen, chunkProviderSettings.andesiteMinHeight, chunkProviderSettings.andesiteMaxHeight);
    }
    if (TerrainGen.generateOre(worldIn, random, biomeDecorator.coalGen, pos, OreGenEvent.GenerateMinable.EventType.COAL)) {
        this.genStandardOre1(worldIn, random, chunkProviderSettings.coalCount, biomeDecorator.coalGen, chunkProviderSettings.coalMinHeight, chunkProviderSettings.coalMaxHeight);
    }
    if (TerrainGen.generateOre(worldIn, random, biomeDecorator.ironGen, pos, OreGenEvent.GenerateMinable.EventType.IRON)) {
        this.genStandardOre1(worldIn, random, chunkProviderSettings.ironCount, biomeDecorator.ironGen, chunkProviderSettings.ironMinHeight, chunkProviderSettings.ironMaxHeight);
    }
    if (TerrainGen.generateOre(worldIn, random, biomeDecorator.goldGen, pos, OreGenEvent.GenerateMinable.EventType.GOLD)) {
        this.genStandardOre1(worldIn, random, chunkProviderSettings.goldCount, biomeDecorator.goldGen, chunkProviderSettings.goldMinHeight, chunkProviderSettings.goldMaxHeight);
    }
    if (TerrainGen.generateOre(worldIn, random, biomeDecorator.redstoneGen, pos, OreGenEvent.GenerateMinable.EventType.REDSTONE)) {
        this.genStandardOre1(worldIn, random, chunkProviderSettings.redstoneCount, biomeDecorator.redstoneGen, chunkProviderSettings.redstoneMinHeight, chunkProviderSettings.redstoneMaxHeight);
    }
    if (TerrainGen.generateOre(worldIn, random, biomeDecorator.diamondGen, pos, OreGenEvent.GenerateMinable.EventType.DIAMOND)) {
        this.genStandardOre1(worldIn, random, chunkProviderSettings.diamondCount, biomeDecorator.diamondGen, chunkProviderSettings.diamondMinHeight, chunkProviderSettings.diamondMaxHeight);
    }
    if (TerrainGen.generateOre(worldIn, random, biomeDecorator.lapisGen, pos, OreGenEvent.GenerateMinable.EventType.LAPIS)) {
        this.genStandardOre2(worldIn, random, chunkProviderSettings.lapisCount, biomeDecorator.lapisGen, chunkProviderSettings.lapisCenterHeight, chunkProviderSettings.lapisSpread);
    }
    if (rbb.generatesEmeralds()) {
        this.genEmeraldOre(worldIn, random, pos);
    }
    if (rbb.generatesSilverfish()) {
        this.genSilverfishOre(worldIn, random, pos);
    }
    if (rbb.getExtraGoldGenCount() > 0) {
        this.genStandardOre1(worldIn, random, rbb.getExtraGoldGenCount(), biomeDecorator.goldGen, rbb.getExtraGoldGenMinHeight(), rbb.getExtraGoldGenMaxHeight());
    }
    MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Post(worldIn, random, pos));
//Logger.debug("Finished generating ores in %s (%d %d)", this.biome.getBiomeName(), worldX, worldZ);
}
Also used : ChunkProviderSettings(net.minecraft.world.gen.ChunkProviderSettings) OreGenEvent(net.minecraftforge.event.terraingen.OreGenEvent) BlockPos(net.minecraft.util.math.BlockPos) BiomeDecorator(net.minecraft.world.biome.BiomeDecorator)

Example 2 with BiomeDecorator

use of net.minecraft.world.biome.BiomeDecorator in project RecurrentComplex by Ivorforce.

the class RCBiomeDecorator method doDecorate.

protected static Event.Result doDecorate(WorldServer worldIn, Random random, BlockPos chunkPos, DecorationType type) {
    Biome biomeIn = worldIn.getBiome(chunkPos.add(16, 0, 16));
    BiomeDecorator decorator = biomeIn.decorator;
    Adapter adapter = adapter(worldIn, chunkPos, type, biomeIn, decorator);
    int origAmount = adapter.amount(worldIn, random, biomeIn, decorator, chunkPos, type);
    // Don't interfere
    if (origAmount < 0)
        return null;
    int vanillaAmount = doDecorate(worldIn, random, chunkPos, type, origAmount, adapter.mayGiveUp(worldIn, random, biomeIn, decorator, chunkPos, type));
    // Replaced none, might as well give back
    if (vanillaAmount == origAmount)
        return null;
    for (int i = 0; i < vanillaAmount; ++i) adapter.generate(worldIn, random, biomeIn, decorator, chunkPos, type);
    // if < 0 we let vanilla do its thing
    return vanillaAmount >= 0 ? Event.Result.DENY : null;
}
Also used : Biome(net.minecraft.world.biome.Biome) BiomeDecorator(net.minecraft.world.biome.BiomeDecorator)

Aggregations

BiomeDecorator (net.minecraft.world.biome.BiomeDecorator)2 BlockPos (net.minecraft.util.math.BlockPos)1 Biome (net.minecraft.world.biome.Biome)1 ChunkProviderSettings (net.minecraft.world.gen.ChunkProviderSettings)1 OreGenEvent (net.minecraftforge.event.terraingen.OreGenEvent)1