Search in sources :

Example 1 with WorldGenCacti

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

the class DecoCactus 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 WorldGenCacti(this.sandOnly, 0, this.soilBlock);
            int loopCount = this.loops;
            loopCount = (this.strengthFactor > 0f) ? (int) (this.strengthFactor * strength) : loopCount;
            for (int i = 0; i < loopCount * 10; i++) {
                // + 8;
                int intX = worldX + rand.nextInt(16);
                int intY = rand.nextInt(this.maxY);
                // + 8;
                int intZ = worldZ + rand.nextInt(16);
                if (intY <= this.maxY && rand.nextInt(this.chance) == 0) {
                    worldGenerator.generate(rtgWorld.world, rand, new BlockPos(intX, intY, intZ));
                }
            }
        }
    }
}
Also used : WorldGenerator(net.minecraft.world.gen.feature.WorldGenerator) WorldGenCacti(rtg.api.world.gen.feature.WorldGenCacti) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

BlockPos (net.minecraft.util.math.BlockPos)1 WorldGenerator (net.minecraft.world.gen.feature.WorldGenerator)1 WorldGenCacti (rtg.api.world.gen.feature.WorldGenCacti)1