use of rtg.api.world.gen.feature.WorldGenCrops in project Realistic-Terrain-Generation by Team-RTG.
the class DecoCrop 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 WorldGenCrops(type, size, density, height, water);
if (this.chance < 1) {
return;
}
for (int l1 = 0; l1 < this.strengthFactor * strength; ++l1) {
// + 8;
int i1 = worldX + rand.nextInt(16);
// + 8;
int j1 = worldZ + rand.nextInt(16);
int k1 = rtgWorld.world.getHeight(new BlockPos(i1, 0, j1)).getY();
if (k1 >= this.minY && k1 <= this.maxY && rand.nextInt(this.chance) == 0) {
// If we're in a village, check to make sure the boulder has extra room to grow to avoid corrupting the village.
if (hasPlacedVillageBlocks) {
if (!worldUtil.isSurroundedByBlock(Blocks.AIR.getDefaultState(), 2, WorldUtil.SurroundCheckType.CARDINAL, rand, i1, k1, j1)) {
return;
}
}
worldGenerator.generate(rtgWorld.world, rand, new BlockPos(i1, k1, j1));
}
}
}
}
Aggregations