use of com.almuradev.content.type.flower.FlowerFeature in project Almura by AlmuraDev.
the class FlowerGeneratorImpl method decorate.
@SubscribeEvent
public void decorate(final DecorateBiomeEvent.Decorate event) {
if (event.getType() != DecorateBiomeEvent.Decorate.EventType.FLOWERS || event.getResult() == Event.Result.DENY) {
return;
}
final World world = event.getWorld();
if (!this.in(world)) {
return;
}
final DoubleRange chance = this.chance(world.getBiome(event.getPos()));
if (chance == null || chance.max() == 0) {
return;
}
final Random random = event.getRand();
if (random.nextDouble() <= (chance.random(random) / 100d)) {
final int x = random.nextInt(16) + 8;
final int z = random.nextInt(16) + 8;
final BlockPos pos = world.getHeight(event.getPos().add(x, 0, z));
((FlowerFeature) this.flower.require()).generate(world, random, pos, this.requires);
event.setResult(Event.Result.DENY);
}
}
Aggregations