Search in sources :

Example 1 with ToolRenderHelper

use of net.silentchaos512.gems.item.ToolRenderHelper in project SilentGems by SilentChaos512.

the class ItemGemArmor method clAddInformation.

@Override
public void clAddInformation(ItemStack stack, World world, List<String> list, boolean advanced) {
    LocalizationHelper loc = SilentGems.localizationHelper;
    ToolRenderHelper helper = ToolRenderHelper.getInstance();
    boolean controlDown = KeyTracker.isControlDown();
    boolean shiftDown = KeyTracker.isShiftDown();
    boolean altDown = KeyTracker.isAltDown();
    String line;
    // UUID
    if (GemsConfig.DEBUG_MODE && controlDown && shiftDown) {
        UUID uuid = ToolHelper.hasUUID(stack) ? ToolHelper.getUUID(stack) : null;
        list.add(uuid == null ? "No UUID" : uuid.toString());
        uuid = ToolHelper.getSoulUUID(stack);
        list.add(uuid == null ? "No Soul UUID" : uuid.toString());
    }
    // Tool Soul
    ToolSoul soul = SoulManager.getSoul(stack);
    if (soul != null) {
        soul.addInformation(stack, world, list, advanced);
    }
    // Show original owner?
    if (controlDown) {
        String owner = ArmorHelper.getOriginalOwner(stack);
        if (!owner.isEmpty()) {
            list.add(loc.getMiscText("Tooltip.OriginalOwner", owner));
        } else {
            list.add(loc.getMiscText("Tooltip.OriginalOwner.Unknown"));
        }
    }
    // TODO: Remove me
    if (altDown) {
        list.add(TextFormatting.RED + "Armor models WIP.");
    }
    // Broken?
    if (ArmorHelper.isBroken(stack)) {
        list.add(loc.getMiscText("Tooltip.Broken"));
    }
    final String sep = loc.getMiscText("Tooltip.Separator");
    if (controlDown) {
        // Properties header
        list.add(loc.getMiscText("Tooltip.Properties"));
        TextFormatting color = TextFormatting.YELLOW;
        float durabilityBoost = ToolSoul.getDurabilityModifierForDisplay(soul);
        list.add(color + helper.getTooltipLine("Durability", getMaxDamage(stack), durabilityBoost));
        float protectionBoost = ToolSoul.getProtectionModifierForDisplay(soul);
        list.add(color + helper.getTooltipLine("Protection", getProtection(stack), protectionBoost));
        // Statistics Header
        list.add(sep);
        list.add(loc.getMiscText("Tooltip.Statistics"));
        list.add(helper.getTooltipLine("DamageTaken", ArmorHelper.getStatDamageTaken(stack), 0f));
        list.add(helper.getTooltipLine("Redecorated", ArmorHelper.getStatRedecorated(stack), 0f));
        list.add(sep);
    } else {
        list.add(TextFormatting.GOLD + loc.getMiscText("PressCtrl"));
    }
    if (altDown) {
        list.add(loc.getMiscText("Tooltip.Construction"));
        ToolPart[] parts = ArmorHelper.getConstructionParts(stack);
        EnumMaterialGrade[] grades = ArmorHelper.getConstructionGrades(stack);
        for (int i = 0; i < parts.length; ++i) {
            ToolPart part = parts[i];
            EnumMaterialGrade grade = grades[i];
            line = "  " + TextFormatting.YELLOW + part.getKey() + TextFormatting.GOLD + " (" + grade + ")";
            list.add(line);
        }
        ToolPart partFrame = ArmorHelper.getPart(stack, ArmorPartPosition.FRAME);
        if (partFrame != null)
            list.add("  " + TextFormatting.YELLOW + partFrame.getKey());
        list.add(sep);
    } else {
        list.add(TextFormatting.GOLD + loc.getMiscText("PressAlt"));
    }
}
Also used : ToolRenderHelper(net.silentchaos512.gems.item.ToolRenderHelper) LocalizationHelper(net.silentchaos512.lib.util.LocalizationHelper) ToolSoul(net.silentchaos512.gems.lib.soul.ToolSoul) ToolPart(net.silentchaos512.gems.api.tool.part.ToolPart) EnumMaterialGrade(net.silentchaos512.gems.api.lib.EnumMaterialGrade) TextFormatting(net.minecraft.util.text.TextFormatting) UUID(java.util.UUID)

Aggregations

UUID (java.util.UUID)1 TextFormatting (net.minecraft.util.text.TextFormatting)1 EnumMaterialGrade (net.silentchaos512.gems.api.lib.EnumMaterialGrade)1 ToolPart (net.silentchaos512.gems.api.tool.part.ToolPart)1 ToolRenderHelper (net.silentchaos512.gems.item.ToolRenderHelper)1 ToolSoul (net.silentchaos512.gems.lib.soul.ToolSoul)1 LocalizationHelper (net.silentchaos512.lib.util.LocalizationHelper)1