Search in sources :

Example 26 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 27 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 28 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)

Example 29 with WorldGenerator

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

the class DecoReed 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), REED)) {
            WorldGenerator worldGenerator = new WorldGenReed();
            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) {
                    worldGenerator.generate(rtgWorld.world, rand, new BlockPos(intX, intY, intZ));
                }
            }
        }
    }
}
Also used : WorldGenerator(net.minecraft.world.gen.feature.WorldGenerator) BlockPos(net.minecraft.util.math.BlockPos) WorldGenReed(net.minecraft.world.gen.feature.WorldGenReed)

Example 30 with WorldGenerator

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

the class DecoFlowersRTG 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), FLOWERS)) {
            WorldGenerator worldGenerator = new WorldGenFlowersRTG(this.flowers);
            this.setLoops((this.strengthFactor > 0f) ? (int) (this.strengthFactor * strength) : this.loops);
            for (int i = 0; i < this.loops * 16; i++) {
                // + 8;
                int intX = worldX + rand.nextInt(16);
                // + 8;
                int intZ = worldZ + rand.nextInt(16);
                int intY;
                switch(this.heightType) {
                    case NEXT_INT:
                        intY = RandomUtil.getRandomInt(rand, this.minY, this.maxY);
                        break;
                    case GET_HEIGHT_VALUE:
                        intY = rtgWorld.world.getHeight(new BlockPos(intX, 0, intZ)).getY();
                        break;
                    default:
                        intY = rand.nextInt(this.maxY);
                        break;
                }
                if (this.notEqualsZeroChance > 1) {
                    if (rand.nextInt(this.notEqualsZeroChance) != 0) {
                        worldGenerator.generate(rtgWorld.world, rand, new BlockPos(intX, intY, intZ));
                    }
                } else {
                    if (rand.nextInt(this.chance) == 0) {
                        worldGenerator.generate(rtgWorld.world, rand, new BlockPos(intX, intY, intZ));
                    }
                }
            }
        }
    }
}
Also used : WorldGenerator(net.minecraft.world.gen.feature.WorldGenerator) BlockPos(net.minecraft.util.math.BlockPos) WorldGenFlowersRTG(rtg.api.world.gen.feature.WorldGenFlowersRTG)

Aggregations

WorldGenerator (net.minecraft.world.gen.feature.WorldGenerator)44 BlockPos (net.minecraft.util.math.BlockPos)25 IBlockState (net.minecraft.block.state.IBlockState)8 WorldUtil (rtg.api.util.WorldUtil)7 World (net.minecraft.world.World)3 WorldGenMinable (net.minecraft.world.gen.feature.WorldGenMinable)3 WorldGenGrass (rtg.api.world.gen.feature.WorldGenGrass)3 MapMaker (com.google.common.collect.MapMaker)2 ITree (forestry.api.arboriculture.ITree)2 WorldGenBase (forestry.core.worldgen.WorldGenBase)2 Predicate (java.util.function.Predicate)2 RailcraftConfig (mods.railcraft.common.core.RailcraftConfig)2 NoiseGenSimplex (mods.railcraft.common.worldgen.NoiseGen.NoiseGenSimplex)2 Vec3 (net.minecraft.util.Vec3)2 Biome (net.minecraft.world.biome.Biome)2 WorldGenTrees (net.minecraft.world.gen.feature.WorldGenTrees)2 EventType (net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType)2 TerrainGen (net.minecraftforge.event.terraingen.TerrainGen)2 DecorateBiomeEventRTG (rtg.api.event.DecorateBiomeEventRTG)2 WorldGenBigTrees (betterwithaddons.world.WorldGenBigTrees)1