Search in sources :

Example 1 with IArmorNaturalist

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);
}
Also used : Item(net.minecraft.item.Item) IArmorNaturalist(forestry.api.core.IArmorNaturalist) ItemStack(net.minecraft.item.ItemStack)

Aggregations

IArmorNaturalist (forestry.api.core.IArmorNaturalist)1 Item (net.minecraft.item.Item)1 ItemStack (net.minecraft.item.ItemStack)1