Search in sources :

Example 1 with IItemDurabilityManager

use of gregtech.api.items.metaitem.stats.IItemDurabilityManager in project GregTech by GregTechCE.

the class TurbineRotorBehavior method getInstanceFor.

public static TurbineRotorBehavior getInstanceFor(ItemStack itemStack) {
    if (!(itemStack.getItem() instanceof MetaItem)) {
        return null;
    }
    MetaItem<?> metaItem = (MetaItem<?>) itemStack.getItem();
    MetaValueItem valueItem = metaItem.getItem(itemStack);
    if (valueItem == null) {
        return null;
    }
    IItemDurabilityManager durabilityManager = valueItem.getDurabilityManager();
    if (!(durabilityManager instanceof TurbineRotorBehavior)) {
        return null;
    }
    return (TurbineRotorBehavior) durabilityManager;
}
Also used : MetaValueItem(gregtech.api.items.metaitem.MetaItem.MetaValueItem) MetaItem(gregtech.api.items.metaitem.MetaItem) IItemDurabilityManager(gregtech.api.items.metaitem.stats.IItemDurabilityManager)

Aggregations

MetaItem (gregtech.api.items.metaitem.MetaItem)1 MetaValueItem (gregtech.api.items.metaitem.MetaItem.MetaValueItem)1 IItemDurabilityManager (gregtech.api.items.metaitem.stats.IItemDurabilityManager)1