use of forestry.api.core.IArmorNaturalist in project ForestryMC by ForestryMC.
the class GeneticsUtil method hasNaturalistEye.
public static boolean hasNaturalistEye(EntityPlayer player) {
ItemStack armorItemStack = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
if (armorItemStack.isEmpty()) {
return false;
}
final Item armorItem = armorItemStack.getItem();
final IArmorNaturalist armorNaturalist;
if (armorItem instanceof IArmorNaturalist) {
// legacy
armorNaturalist = (IArmorNaturalist) armorItem;
} else if (armorItemStack.hasCapability(ArboricultureCapabilities.ARMOR_NATURALIST, null)) {
armorNaturalist = armorItemStack.getCapability(ArboricultureCapabilities.ARMOR_NATURALIST, null);
} else {
return false;
}
return armorNaturalist != null && armorNaturalist.canSeePollination(player, armorItemStack, true);
}
Aggregations