Search in sources :

Example 1 with WorldGenFlowersRTG

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

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