use of biomesoplenty.common.block.BlockBOPDecoration in project BiomesOPlenty by Glitchfiend.
the class GeneratorDoubleFlora method generate.
@Override
public boolean generate(World world, Random random, BlockPos pos) {
Block bottomBlock = this.with.getBlock();
for (int i = 0; i < this.generationAttempts; ++i) {
BlockPos genPos = pos.add(random.nextInt(8) - random.nextInt(8), random.nextInt(4) - random.nextInt(4), random.nextInt(8) - random.nextInt(8));
if (this.placeOn.matches(world, genPos.down()) && this.replace.matches(world, genPos) && this.replace.matches(world, genPos.up()) && genPos.getY() < 254) {
boolean canStay;
if (bottomBlock instanceof BlockBOPDecoration) {
canStay = ((BlockBOPDecoration) bottomBlock).canBlockStay(world, genPos, this.with);
} else if (bottomBlock instanceof BlockBush) {
canStay = bottomBlock.canPlaceBlockAt(world, genPos);
} else {
canStay = bottomBlock.canPlaceBlockAt(world, genPos);
}
if (canStay) {
world.setBlockState(genPos, this.with, 2);
world.setBlockState(genPos.up(), this.withTop, 2);
}
}
}
return true;
}
Aggregations