Search in sources :

Example 1 with WorldGenGrass

use of rtg.api.world.gen.feature.WorldGenGrass in project Realistic-Terrain-Generation by Team-RTG.

the class DecoDoubleGrass 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 worldGenerator = new WorldGenGrass(Blocks.DOUBLE_PLANT.getStateFromMeta(2), 2);
            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 : WorldGenGrass(rtg.api.world.gen.feature.WorldGenGrass) WorldGenerator(net.minecraft.world.gen.feature.WorldGenerator) BlockPos(net.minecraft.util.math.BlockPos)

Example 2 with WorldGenGrass

use of rtg.api.world.gen.feature.WorldGenGrass in project Realistic-Terrain-Generation by Team-RTG.

the class DecoGrassDoubleTallgrass 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 worldGenerator = null;
            if (this.doubleGrassChance > 0) {
                if (rand.nextInt(this.doubleGrassChance) == 0) {
                    worldGenerator = new WorldGenGrass(Blocks.DOUBLE_PLANT.getStateFromMeta(2), 2);
                } else {
                    worldGenerator = new WorldGenGrass(Blocks.TALLGRASS.getStateFromMeta(1), 1);
                }
            } else if (this.grassChance > 0) {
                if (rand.nextInt(this.grassChance) == 0) {
                    worldGenerator = new WorldGenGrass(Blocks.TALLGRASS.getStateFromMeta(1), 1);
                } else {
                    worldGenerator = new WorldGenGrass(Blocks.DOUBLE_PLANT.getStateFromMeta(2), 2);
                }
            } else {
                if (rand.nextBoolean()) {
                    worldGenerator = new WorldGenGrass(Blocks.TALLGRASS.getStateFromMeta(1), 1);
                } else {
                    worldGenerator = new WorldGenGrass(Blocks.DOUBLE_PLANT.getStateFromMeta(2), 2);
                }
            }
            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 : WorldGenGrass(rtg.api.world.gen.feature.WorldGenGrass) WorldGenerator(net.minecraft.world.gen.feature.WorldGenerator) BlockPos(net.minecraft.util.math.BlockPos)

Example 3 with WorldGenGrass

use of rtg.api.world.gen.feature.WorldGenGrass 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)

Aggregations

BlockPos (net.minecraft.util.math.BlockPos)3 WorldGenerator (net.minecraft.world.gen.feature.WorldGenerator)3 WorldGenGrass (rtg.api.world.gen.feature.WorldGenGrass)3