use of com.almuradev.content.type.block.type.crop.processor.fertilizer.Fertilizer in project Almura by AlmuraDev.
the class CropBlockImpl method canUseBonemeal.
@Override
public boolean canUseBonemeal(final World world, final Random random, final BlockPos pos, final IBlockState state) {
if (!world.isRemote) {
if (!this.isMaxAge(state)) {
// Return TRUE always when in Dev mode!
if (SpongeImplHooks.isDeobfuscatedEnvironment()) {
return true;
}
// TODO Maybe best to move this into an interact listener and make this hook do nothing
final CropBlockStateDefinition definition = this.definition(state);
if (definition.fertilizer != null) {
final Fertilizer fertilizer = definition.fertilizer;
// TODO Pre-1.13, this is just a mess...maybe need a Deprecated "LazyItemState" that checks data
final DoubleRange chanceRange = fertilizer.getOrLoadChanceRangeForItem(new ItemStack(Items.DYE, 1, 15));
if (chanceRange != null) {
return RANDOM.nextDouble() <= (chanceRange.random(RANDOM) / 100);
}
}
}
}
return false;
}
Aggregations