use of net.minecraft.world.gen.feature.WorldGenBush in project Realistic-Terrain-Generation by Team-RTG.
the class DecoMushrooms 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), SHROOM)) {
// Let's figure out what the rand.nextInt() argument should be.
switch(this.randomType) {
case ALWAYS_GENERATE:
this.setChance(1);
break;
case USE_CHANCE_VALUE:
break;
case X_DIVIDED_BY_STRENGTH:
this.setChance((int) (this.randomFloat / strength));
break;
default:
break;
}
WorldGenerator worldGeneratorBrownShrooms = new WorldGenBush(Blocks.BROWN_MUSHROOM);
WorldGenerator worldGeneratorRedShrooms = new WorldGenBush(Blocks.RED_MUSHROOM);
this.setLoops((this.strengthFactor > 0f) ? (int) (this.strengthFactor * strength) : this.loops);
for (int i = 0; i < this.loops; i++) {
if (rand.nextInt(this.chance) == 0) {
// + 8;
int intX = worldX + rand.nextInt(16);
int intY = rand.nextInt(this.maxY);
// + 8;
int intZ = worldZ + rand.nextInt(16);
if (intY <= this.maxY) {
if (rand.nextBoolean()) {
worldGeneratorBrownShrooms.generate(rtgWorld.world, rand, new BlockPos(intX, intY, intZ));
} else {
worldGeneratorRedShrooms.generate(rtgWorld.world, rand, new BlockPos(intX, intY, intZ));
}
}
}
}
}
}
}
Aggregations