Search in sources :

Example 16 with EnumMaterialTier

use of net.silentchaos512.gems.api.lib.EnumMaterialTier in project SilentGems by SilentChaos512.

the class GemsClientEvents method onTooltipForToolRod.

private void onTooltipForToolRod(ItemTooltipEvent event, ItemStack stack, ToolPart part, boolean ctrlDown, boolean shiftDown) {
    int index = 1;
    final String sep = loc.getMiscText("Tooltip.Separator");
    List<String> list = event.getToolTip();
    ToolPartRod.Stats stats = ((ToolPartRod) part).getStats();
    // Tool Rod indicator
    list.add(index++, loc.getMiscText("ToolPart.Rod"));
    if (ctrlDown) {
        // Compatible tiers
        String line = "";
        for (EnumMaterialTier tier : part.getCompatibleTiers()) {
            if (!line.isEmpty())
                line += ", ";
            line += tier.getLocalizedName();
        }
        list.add(index++, loc.getMiscText("ToolPart.ValidTiers"));
        list.add(index++, "  " + line);
        list.add(index++, sep);
        TextFormatting color = TextFormatting.GOLD;
        list.add(index++, color + TooltipHelper.getAsColoredPercentage("HarvestSpeed", stats.harvestSpeedMulti));
        // list.add(index++, color + TooltipHelper.get("HarvestLevel", part.getHarvestLevel()));
        color = TextFormatting.DARK_GREEN;
        list.add(index++, color + TooltipHelper.getAsColoredPercentage("MeleeDamage", stats.meleeDamageMulti));
        list.add(index++, color + TooltipHelper.getAsColoredPercentage("MagicDamage", stats.magicDamageMulti));
        // list.add(index++, color + TooltipHelper.get("MeleeSpeed", (int) (part.getMeleeSpeed() * 100)));
        color = TextFormatting.BLUE;
        list.add(index++, color + TooltipHelper.getAsColoredPercentage("Durability", stats.durabilityMulti));
        list.add(index++, color + TooltipHelper.getAsColoredPercentage("Enchantability", stats.enchantabilityMulti));
        list.add(index++, sep);
        // Debug info
        if (shiftDown) {
            list.add(index++, TextFormatting.DARK_GRAY + "* Part key: " + part.getKey());
        }
    } else {
        list.add(index++, loc.getMiscText("PressCtrl"));
    }
}
Also used : TextFormatting(net.minecraft.util.text.TextFormatting) EnumMaterialTier(net.silentchaos512.gems.api.lib.EnumMaterialTier) ToolPartRod(net.silentchaos512.gems.api.tool.part.ToolPartRod)

Aggregations

EnumMaterialTier (net.silentchaos512.gems.api.lib.EnumMaterialTier)16 ItemStack (net.minecraft.item.ItemStack)7 ToolPart (net.silentchaos512.gems.api.tool.part.ToolPart)6 ITool (net.silentchaos512.gems.api.ITool)5 EnumMaterialGrade (net.silentchaos512.gems.api.lib.EnumMaterialGrade)5 TextFormatting (net.minecraft.util.text.TextFormatting)3 ArrayList (java.util.ArrayList)2 EntityEquipmentSlot (net.minecraft.inventory.EntityEquipmentSlot)2 Item (net.minecraft.item.Item)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 IArmor (net.silentchaos512.gems.api.IArmor)2 ArmorPartFrame (net.silentchaos512.gems.api.tool.part.ArmorPartFrame)2 ToolPartMain (net.silentchaos512.gems.api.tool.part.ToolPartMain)2 ToolPartRod (net.silentchaos512.gems.api.tool.part.ToolPartRod)2 ToolPartTip (net.silentchaos512.gems.api.tool.part.ToolPartTip)2 UUID (java.util.UUID)1 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)1 ItemTool (net.minecraft.item.ItemTool)1 IRecipe (net.minecraft.item.crafting.IRecipe)1