Search in sources :

Example 16 with WorldGenerator

use of net.minecraft.world.gen.feature.WorldGenerator in project Realistic-Terrain-Generation by Team-RTG.

the class DecoJungleCacti method generate.

@Override
public void generate(IRealisticBiome biome, RTGWorld rtgWorld, Random rand, int worldX, int worldZ, float strength, float river, boolean hasPlacedVillageBlocks) {
    if (this.allowed) {
        if (TerrainGen.decorate(rtgWorld.world, rand, new BlockPos(worldX, 0, worldZ), CACTUS)) {
            WorldGenerator worldGenerator = new WorldGenJungleCacti(this.sandOnly, rand.nextInt(this.extraHeight), this.sandMeta);
            for (int i = 0; i < this.strengthFactor * strength; i++) {
                // + 8;
                int intX = worldX + rand.nextInt(16);
                int intY = rand.nextInt(160);
                // + 8;
                int intZ = worldZ + rand.nextInt(16);
                if (intY < this.maxY) {
                    worldGenerator.generate(rtgWorld.world, rand, new BlockPos(intX, intY, intZ));
                }
            }
        }
    }
}
Also used : WorldGenerator(net.minecraft.world.gen.feature.WorldGenerator) WorldGenJungleCacti(rtg.api.world.gen.feature.WorldGenJungleCacti) BlockPos(net.minecraft.util.math.BlockPos)

Example 17 with WorldGenerator

use of net.minecraft.world.gen.feature.WorldGenerator in project Realistic-Terrain-Generation by Team-RTG.

the class DecoJungleLilypadVines method generate.

/**
     * No config options for this one yet. Just ripped it directly from the old code.
     */
@Override
public void generate(IRealisticBiome biome, RTGWorld rtgWorld, Random rand, int worldX, int worldZ, float strength, float river, boolean hasPlacedVillageBlocks) {
    if (this.allowed) {
        if (TerrainGen.decorate(rtgWorld.world, rand, new BlockPos(worldX, 0, worldZ), LILYPAD)) {
            WorldGenerator worldgeneratorLilypads = new WorldGenWaterlily();
            WorldGenerator worldgeneratorVines = new WorldGenVinesRTG();
            Block vb;
            for (int b33 = 0; b33 < 5; b33++) {
                int j6 = worldX + rand.nextInt(16) + 8;
                int k10 = worldZ + rand.nextInt(16) + 8;
                int z52 = rtgWorld.world.getHeight(new BlockPos(j6, 0, k10)).getY();
                for (int h44 = 0; h44 < 8; h44++) {
                    if (z52 > 64) {
                        worldgeneratorLilypads.generate(rtgWorld.world, rand, new BlockPos(j6, z52, k10));
                    }
                }
                for (int h44 = 100; h44 > 0; h44--) {
                    worldgeneratorVines.generate(rtgWorld.world, rand, new BlockPos(j6, z52, k10));
                }
            }
        }
    }
}
Also used : WorldGenerator(net.minecraft.world.gen.feature.WorldGenerator) WorldGenWaterlily(net.minecraft.world.gen.feature.WorldGenWaterlily) Block(net.minecraft.block.Block) BlockPos(net.minecraft.util.math.BlockPos) WorldGenVinesRTG(rtg.api.world.gen.feature.WorldGenVinesRTG)

Example 18 with WorldGenerator

use of net.minecraft.world.gen.feature.WorldGenerator in project Realistic-Terrain-Generation by Team-RTG.

the class DecoLargeFernDoubleTallgrass method generate.

@Override
public void generate(IRealisticBiome biome, RTGWorld rtgWorld, Random rand, int worldX, int worldZ, float strength, float river, boolean hasPlacedVillageBlocks) {
    if (this.allowed) {
        if (TerrainGen.decorate(rtgWorld.world, rand, new BlockPos(worldX, 0, worldZ), GRASS)) {
            WorldGenerator worldgeneratorDoubleTallgrass = new WorldGenGrass(Blocks.DOUBLE_PLANT.getStateFromMeta(GRASS_META), GRASS_META);
            WorldGenerator worldgeneratorLargeFern = new WorldGenGrass(Blocks.DOUBLE_PLANT.getStateFromMeta(FERN_META), FERN_META);
            this.setLoops((this.strengthFactor > 0f) ? (int) (this.strengthFactor * strength) : this.loops);
            for (int i = 0; i < this.loops; i++) {
                int intX = worldX + rand.nextInt(16) + 8;
                int intY = rand.nextInt(this.maxY);
                int intZ = worldZ + rand.nextInt(16) + 8;
                if (intY <= this.maxY) {
                    if (this.fernChance > 0) {
                        if (rand.nextInt(this.fernChance) == 0) {
                            worldgeneratorLargeFern.generate(rtgWorld.world, rand, new BlockPos(intX, intY, intZ));
                        } else {
                            worldgeneratorDoubleTallgrass.generate(rtgWorld.world, rand, new BlockPos(intX, intY, intZ));
                        }
                    } else if (this.grassChance > 0) {
                        if (rand.nextInt(this.grassChance) == 0) {
                            worldgeneratorDoubleTallgrass.generate(rtgWorld.world, rand, new BlockPos(intX, intY, intZ));
                        } else {
                            worldgeneratorLargeFern.generate(rtgWorld.world, rand, new BlockPos(intX, intY, intZ));
                        }
                    } else {
                        if (rand.nextBoolean()) {
                            worldgeneratorDoubleTallgrass.generate(rtgWorld.world, rand, new BlockPos(intX, intY, intZ));
                        } else {
                            worldgeneratorLargeFern.generate(rtgWorld.world, rand, new BlockPos(intX, intY, intZ));
                        }
                    }
                }
            }
        }
    }
}
Also used : WorldGenGrass(rtg.api.world.gen.feature.WorldGenGrass) WorldGenerator(net.minecraft.world.gen.feature.WorldGenerator) BlockPos(net.minecraft.util.math.BlockPos)

Example 19 with WorldGenerator

use of net.minecraft.world.gen.feature.WorldGenerator in project Realistic-Terrain-Generation by Team-RTG.

the class DecoMushrooms method generate.

@Override
public void generate(IRealisticBiome biome, RTGWorld rtgWorld, Random rand, int worldX, int worldZ, float strength, float river, boolean hasPlacedVillageBlocks) {
    if (this.allowed) {
        if (TerrainGen.decorate(rtgWorld.world, rand, new BlockPos(worldX, 0, worldZ), SHROOM)) {
            // Let's figure out what the rand.nextInt() argument should be.
            switch(this.randomType) {
                case ALWAYS_GENERATE:
                    this.setChance(1);
                    break;
                case USE_CHANCE_VALUE:
                    break;
                case X_DIVIDED_BY_STRENGTH:
                    this.setChance((int) (this.randomFloat / strength));
                    break;
                default:
                    break;
            }
            WorldGenerator worldGeneratorBrownShrooms = new WorldGenBush(Blocks.BROWN_MUSHROOM);
            WorldGenerator worldGeneratorRedShrooms = new WorldGenBush(Blocks.RED_MUSHROOM);
            this.setLoops((this.strengthFactor > 0f) ? (int) (this.strengthFactor * strength) : this.loops);
            for (int i = 0; i < this.loops; i++) {
                if (rand.nextInt(this.chance) == 0) {
                    // + 8;
                    int intX = worldX + rand.nextInt(16);
                    int intY = rand.nextInt(this.maxY);
                    // + 8;
                    int intZ = worldZ + rand.nextInt(16);
                    if (intY <= this.maxY) {
                        if (rand.nextBoolean()) {
                            worldGeneratorBrownShrooms.generate(rtgWorld.world, rand, new BlockPos(intX, intY, intZ));
                        } else {
                            worldGeneratorRedShrooms.generate(rtgWorld.world, rand, new BlockPos(intX, intY, intZ));
                        }
                    }
                }
            }
        }
    }
}
Also used : WorldGenerator(net.minecraft.world.gen.feature.WorldGenerator) WorldGenBush(net.minecraft.world.gen.feature.WorldGenBush) BlockPos(net.minecraft.util.math.BlockPos)

Example 20 with WorldGenerator

use of net.minecraft.world.gen.feature.WorldGenerator in project Realistic-Terrain-Generation by Team-RTG.

the class DecoPumpkin method generate.

@Override
public void generate(IRealisticBiome biome, RTGWorld rtgWorld, Random rand, int worldX, int worldZ, float strength, float river, boolean hasPlacedVillageBlocks) {
    if (this.allowed) {
        if (TerrainGen.decorate(rtgWorld.world, rand, new BlockPos(worldX, 0, worldZ), PUMPKIN)) {
            // Let's figure out what the rand.nextInt() argument should be.
            switch(this.randomType) {
                case ALWAYS_GENERATE:
                    this.setChance(1);
                    break;
                case USE_CHANCE_VALUE:
                    break;
                case X_DIVIDED_BY_STRENGTH:
                    this.setChance((int) (this.randomFloat / strength));
                    break;
                default:
                    break;
            }
            WorldGenerator worldGenerator = new WorldGenPumpkin();
            this.setLoops((this.strengthFactor > 0f) ? (int) (this.strengthFactor * strength) : this.loops);
            for (int i = 0; i < this.loops; i++) {
                if (rand.nextInt(this.chance) == 0) {
                    int intX = worldX + rand.nextInt(16) + 8;
                    int intY = rand.nextInt(this.maxY);
                    int intZ = worldZ + rand.nextInt(16) + 8;
                    if (intY <= this.maxY) {
                        worldGenerator.generate(rtgWorld.world, rand, new BlockPos(intX, intY, intZ));
                    }
                }
            }
        }
    }
}
Also used : WorldGenerator(net.minecraft.world.gen.feature.WorldGenerator) WorldGenPumpkin(net.minecraft.world.gen.feature.WorldGenPumpkin) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

WorldGenerator (net.minecraft.world.gen.feature.WorldGenerator)24 BlockPos (net.minecraft.util.math.BlockPos)22 WorldUtil (rtg.api.util.WorldUtil)7 WorldGenGrass (rtg.api.world.gen.feature.WorldGenGrass)3 IBlockState (net.minecraft.block.state.IBlockState)2 WorldGenBigTrees (betterwithaddons.world.WorldGenBigTrees)1 MapMaker (com.google.common.collect.MapMaker)1 java.util (java.util)1 Predicate (java.util.function.Predicate)1 Nullable (javax.annotation.Nullable)1 RailcraftConfig (mods.railcraft.common.core.RailcraftConfig)1 Metal (mods.railcraft.common.items.Metal)1 NoiseGenSimplex (mods.railcraft.common.worldgen.NoiseGen.NoiseGenSimplex)1 Block (net.minecraft.block.Block)1 World (net.minecraft.world.World)1 Biome (net.minecraft.world.biome.Biome)1 WorldGenBush (net.minecraft.world.gen.feature.WorldGenBush)1 WorldGenDeadBush (net.minecraft.world.gen.feature.WorldGenDeadBush)1 WorldGenDesertWells (net.minecraft.world.gen.feature.WorldGenDesertWells)1 WorldGenMinable (net.minecraft.world.gen.feature.WorldGenMinable)1