Search in sources :

Example 1 with WorldGenSeaweed

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

the class DecoSeaweed 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) {
        /*
             * Determine how much seaweed we're going to try to generate (loopCount).
             * The actual amount of seaweed that ends up being generated could be *less* than this value,
             * depending on environmental conditions.
             */
        float noise = rtgWorld.simplex.noise2(worldX / this.distribution.noiseDivisor, worldZ / this.distribution.noiseDivisor) * this.distribution.noiseFactor + this.distribution.noiseAddend;
        int loopCount = this.loops;
        loopCount = (this.strengthFactorForLoops > 0f) ? (int) (this.strengthFactorForLoops * strength) : loopCount;
        loopCount = (this.strengthNoiseFactorForLoops) ? (int) (noise * strength) : loopCount;
        loopCount = (this.strengthNoiseFactorXForLoops) ? (int) (noise * this.strengthFactorForLoops * strength) : loopCount;
        if (loopCount < 1) {
            return;
        }
        WorldGenerator worldGen = new WorldGenSeaweed(this.seaweedBlock, RandomUtil.getRandomInt(rand, this.minHeight, this.maxHeight));
        for (int i = 0; i < loopCount; i++) {
            // + 8;
            int intX = scatter.get(rand, worldX);
            // + 8;
            int intZ = scatter.get(rand, worldZ);
            int intY = RandomUtil.getRandomInt(rand, this.minY, this.maxY);
            if (intY <= this.maxY && intY >= this.minY && isValidCondition(noise, rand, strength)) {
                worldGen.generate(rtgWorld.world, rand, new BlockPos(intX, intY, intZ));
            }
        }
    }
}
Also used : WorldGenerator(net.minecraft.world.gen.feature.WorldGenerator) WorldGenSeaweed(rtg.api.world.gen.feature.WorldGenSeaweed) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

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