Search in sources :

Example 1 with WorldGenLayers

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

the class DecoLayer 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) {
        WorldUtil worldUtil = new WorldUtil(rtgWorld.world);
        WorldGenerator worldGenerator = new WorldGenLayers(this.layerBlock, this.layerProperty, this.dropHeight, this.layerRange, this.layerScatter);
        int loopCount = this.loops;
        loopCount = (this.strengthFactor > 0f) ? (int) (this.strengthFactor * strength) : loopCount;
        for (int i = 0; i < loopCount; i++) {
            // + 8;
            int intX = worldX + rand.nextInt(16);
            // + 8;
            int intZ = worldZ + rand.nextInt(16);
            int intY = rtgWorld.world.getHeight(new BlockPos(intX, 0, intZ)).getY();
            if (this.notEqualsZeroChance > 1) {
                if (intY >= this.minY && intY <= this.maxY && rand.nextInt(this.notEqualsZeroChance) != 0) {
                    generateWorldGenerator(worldGenerator, worldUtil, rtgWorld.world, rand, intX, intY, intZ, hasPlacedVillageBlocks);
                }
            } else {
                if (intY >= this.minY && intY <= this.maxY && rand.nextInt(this.chance) == 0) {
                    generateWorldGenerator(worldGenerator, worldUtil, rtgWorld.world, rand, intX, intY, intZ, hasPlacedVillageBlocks);
                }
            }
        }
    }
}
Also used : WorldGenerator(net.minecraft.world.gen.feature.WorldGenerator) WorldGenLayers(rtg.api.world.gen.feature.WorldGenLayers) BlockPos(net.minecraft.util.math.BlockPos) WorldUtil(rtg.api.util.WorldUtil)

Aggregations

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