/** * Checks a position for suitability, and then plants a flower there. * Returns true on success. * For implementers, you can plant a random flower using IFlowerGrowthHelper.plantRandomFlower * * @since Forestry 5.5.4 */ default boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, BlockPos pos, Collection<IBlockState> potentialFlowers) { //noinspection deprecation return growFlower(helper, flowerType, world, pos); } }
@Override @Deprecated public boolean growFlower(String flowerType, World world, IIndividual individual, BlockPos pos) { if (!this.growthRules.containsKey(flowerType)) { return false; } for (IFlowerGrowthRule rule : this.growthRules.get(flowerType)) { if (rule.growFlower(this, flowerType, world, pos)) { return true; } } return false; }
@Override public boolean growFlower(String flowerType, World world, IIndividual individual, BlockPos pos, Collection<IBlockState> potentialFlowers) { if (!this.growthRules.containsKey(flowerType)) { return false; } List<IFlowerGrowthRule> growthRules = this.growthRules.get(flowerType); Collections.shuffle(growthRules); for (IFlowerGrowthRule rule : growthRules) { if (rule.growFlower(this, flowerType, world, pos, potentialFlowers)) { return true; } } return false; }