Search in sources :

Example 1 with IAdvancedTooltipProvider

use of com.enderio.core.api.client.gui.IAdvancedTooltipProvider in project EnderIO by SleepyTrousers.

the class DarkSteelRecipeManager method addAdvancedTooltipEntries.

public static void addAdvancedTooltipEntries(@Nonnull ItemStack itemstack, EntityPlayer entityplayer, @Nonnull List<String> list, boolean flag) {
    if (itemstack.getItem() instanceof IDarkSteelItem) {
        List<IDarkSteelUpgrade> applyableUpgrades = new ArrayList<IDarkSteelUpgrade>();
        for (IDarkSteelUpgrade upgrade : UpgradeRegistry.getUpgrades()) {
            if (upgrade instanceof IAdvancedTooltipProvider && upgrade.hasUpgrade(itemstack, (IDarkSteelItem) itemstack.getItem())) {
                ((IAdvancedTooltipProvider) upgrade).addDetailedEntries(itemstack, entityplayer, list, flag);
            } else if (upgrade.canAddToItem(itemstack, (IDarkSteelItem) itemstack.getItem())) {
                applyableUpgrades.add(upgrade);
            }
        }
        if (!applyableUpgrades.isEmpty()) {
            list.add(TextFormatting.YELLOW + EnderIO.lang.localize("tooltip.anvilupgrades") + " ");
            for (IDarkSteelUpgrade up : applyableUpgrades) {
                list.add(Lang.DARK_STEEL_LEVELS1.get(TextFormatting.DARK_AQUA, EnderIO.lang.localizeExact(up.getUnlocalizedName() + ".name")));
                list.add(Lang.DARK_STEEL_LEVELS2.get(TextFormatting.DARK_AQUA, TextFormatting.ITALIC, up.getUpgradeItemName(), up.getLevelCost()));
            }
        }
    }
}
Also used : ArrayList(java.util.ArrayList) IAdvancedTooltipProvider(com.enderio.core.api.client.gui.IAdvancedTooltipProvider) IDarkSteelUpgrade(crazypants.enderio.api.upgrades.IDarkSteelUpgrade) IDarkSteelItem(crazypants.enderio.api.upgrades.IDarkSteelItem)

Aggregations

IAdvancedTooltipProvider (com.enderio.core.api.client.gui.IAdvancedTooltipProvider)1 IDarkSteelItem (crazypants.enderio.api.upgrades.IDarkSteelItem)1 IDarkSteelUpgrade (crazypants.enderio.api.upgrades.IDarkSteelUpgrade)1 ArrayList (java.util.ArrayList)1