Search in sources :

Example 1 with LocalizationHelper

use of net.silentchaos512.lib.util.LocalizationHelper in project SilentGems by SilentChaos512.

the class ItemChaosGem method clAddInformation.

@Override
public void clAddInformation(ItemStack stack, World world, List list, boolean advanced) {
    LocalizationHelper loc = SilentGems.localizationHelper;
    for (Entry<ChaosBuff, Integer> entry : getBuffs(stack).entrySet()) list.add(TextFormatting.GOLD + entry.getKey().getLocalizedName(entry.getValue()));
    int slotsUsed = getSlotsUsed(stack);
    int totalDrain = getTotalChargeDrain(stack, SilentGems.proxy.getClientPlayer());
    list.add(loc.getItemSubText(itemName, "charge", getCharge(stack), getMaxCharge(stack)));
    list.add(loc.getItemSubText(itemName, "slots", slotsUsed, MAX_SLOTS));
    list.add(loc.getItemSubText(itemName, "drain", totalDrain));
}
Also used : LocalizationHelper(net.silentchaos512.lib.util.LocalizationHelper) ChaosBuff(net.silentchaos512.gems.lib.ChaosBuff)

Example 2 with LocalizationHelper

use of net.silentchaos512.lib.util.LocalizationHelper in project SilentGems by SilentChaos512.

the class ToolHelper method createToolName.

public static String createToolName(Item item, List<ItemStack> materials) {
    ToolPart part;
    LocalizationHelper loc = SilentGems.localizationHelper;
    Set<String> prefixSet = Sets.newLinkedHashSet();
    Set<String> materialSet = Sets.newLinkedHashSet();
    for (ItemStack stack : materials) {
        part = ToolPartRegistry.fromStack(stack);
        if (part != null) {
            String prefix = part.getDisplayNamePrefix(stack);
            if (prefix != null && !prefix.isEmpty())
                prefixSet.add(prefix);
            materialSet.add(part.getDisplayName(stack));
        }
    }
    String prefix = String.join(" ", prefixSet);
    if (!prefix.isEmpty())
        prefix += " ";
    String delimiter = loc.getLocalizedString("tool.silentgems:delimiter");
    String materialName = String.join(delimiter, materialSet);
    String toolName = ((IRegistryObject) item).getName();
    String name = loc.getLocalizedString("tool", toolName, materialName);
    return prefix + name;
}
Also used : ToolPart(net.silentchaos512.gems.api.tool.part.ToolPart) IRegistryObject(net.silentchaos512.lib.registry.IRegistryObject) ItemStack(net.minecraft.item.ItemStack) LocalizationHelper(net.silentchaos512.lib.util.LocalizationHelper)

Example 3 with LocalizationHelper

use of net.silentchaos512.lib.util.LocalizationHelper in project SilentGems by SilentChaos512.

the class ItemTipUpgrade method clAddInformation.

@Override
public void clAddInformation(ItemStack stack, World world, List list, boolean advanced) {
    ToolPartTip part = (ToolPartTip) ToolPartRegistry.fromStack(stack);
    if (part != null) {
        LocalizationHelper loc = SilentGems.instance.localizationHelper;
        String line;
        list.add(loc.getItemSubText(itemName, "willReplace"));
        list.add(loc.getItemSubText(itemName, "harvestLevel", part.getHarvestLevel()));
        tooltipLine(loc, list, "durability", part.getDurability());
        tooltipLine(loc, list, "harvestSpeed", part.getHarvestSpeed());
        // tooltipLine(loc, list, "attackSpeed", part.getMeleeSpeed());
        tooltipLine(loc, list, "meleeDamage", part.getMeleeDamage());
        tooltipLine(loc, list, "magicDamage", part.getMagicDamage());
    }
}
Also used : ToolPartTip(net.silentchaos512.gems.api.tool.part.ToolPartTip) LocalizationHelper(net.silentchaos512.lib.util.LocalizationHelper)

Example 4 with LocalizationHelper

use of net.silentchaos512.lib.util.LocalizationHelper 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)

Example 5 with LocalizationHelper

use of net.silentchaos512.lib.util.LocalizationHelper in project SilentGems by SilentChaos512.

the class ToolSoul method addInformation.

public void addInformation(ItemStack stack, World world, List<String> list, boolean advanced) {
    LocalizationHelper loc = SilentGems.localizationHelper;
    String color;
    // Level, XP, AP
    color = "" + TextFormatting.GREEN;
    list.add(color + loc.getMiscText("ToolSoul.level", level, xp, getXpToNextLevel()));
    list.add(color + loc.getMiscText("ToolSoul.actionPoints", actionPoints, getMaxActionPoints()));
    boolean skillsKeyDown = Keyboard.isKeyDown(Keyboard.KEY_S);
    if (skillsKeyDown || stack.getItem() instanceof ItemToolSoul) {
        // Display elements.
        String e1 = element1 == null ? "None" : element1.getDisplayName();
        String e2 = element2 == null ? "None" : element2.getDisplayName();
        String elements = e1 + (e2.equalsIgnoreCase("none") ? "" : ", " + e2);
        list.add(loc.getMiscText("ToolSoul.elements", elements));
    }
    if (skillsKeyDown) {
        // Display stat modifiers.
        color = "  " + TextFormatting.YELLOW;
        float durability = getDurabilityModifierForDisplay(this);
        float harvestSpeed = getHarvestSpeedModifierForDisplay(this);
        float meleeDamage = getMeleeDamageModifierForDisplay(this);
        float magicDamage = getMagicDamageModifierForDisplay(this);
        float protection = getProtectionModifierForDisplay(this);
        if (durability != 0f)
            list.add(color + TooltipHelper.getAsColoredPercentage("Durability", durability, 0, true));
        if (harvestSpeed != 0f)
            list.add(color + TooltipHelper.getAsColoredPercentage("HarvestSpeed", harvestSpeed, 0, true));
        if (meleeDamage != 0f)
            list.add(color + TooltipHelper.getAsColoredPercentage("MeleeDamage", meleeDamage, 0, true));
        if (magicDamage != 0f)
            list.add(color + TooltipHelper.getAsColoredPercentage("MagicDamage", magicDamage, 0, true));
        if (protection != 0f)
            list.add(color + TooltipHelper.getAsColoredPercentage("Protection", protection, 0, true));
        // Display skills.
        for (Entry<SoulSkill, Integer> entry : skills.entrySet()) {
            SoulSkill skill = entry.getKey();
            int level = entry.getValue();
            list.add("  " + skill.getLocalizedName(stack, level));
        }
    } else {
        list.add(TextFormatting.GOLD + loc.getMiscText("Tooltip.keyForSkills"));
    }
}
Also used : ItemToolSoul(net.silentchaos512.gems.item.ItemToolSoul) LocalizationHelper(net.silentchaos512.lib.util.LocalizationHelper)

Aggregations

LocalizationHelper (net.silentchaos512.lib.util.LocalizationHelper)24 ItemStack (net.minecraft.item.ItemStack)6 DimensionalPosition (net.silentchaos512.lib.util.DimensionalPosition)4 TextFormatting (net.minecraft.util.text.TextFormatting)3 ToolPart (net.silentchaos512.gems.api.tool.part.ToolPart)3 UUID (java.util.UUID)2 ActionResult (net.minecraft.util.ActionResult)2 EnumActionResult (net.minecraft.util.EnumActionResult)2 BlockPos (net.minecraft.util.math.BlockPos)2 TextComponentString (net.minecraft.util.text.TextComponentString)2 EnumMaterialGrade (net.silentchaos512.gems.api.lib.EnumMaterialGrade)2 ToolPartTip (net.silentchaos512.gems.api.tool.part.ToolPartTip)2 ChaosBuff (net.silentchaos512.gems.lib.ChaosBuff)2 ToolSoul (net.silentchaos512.gems.lib.soul.ToolSoul)2 Block (net.minecraft.block.Block)1 IBlockState (net.minecraft.block.state.IBlockState)1 Minecraft (net.minecraft.client.Minecraft)1 FontRenderer (net.minecraft.client.gui.FontRenderer)1 ScaledResolution (net.minecraft.client.gui.ScaledResolution)1 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)1