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));
}
}
}
}
Aggregations