Search in sources :

Example 1 with ILeveledItem

use of it.hurts.sskirillss.relics.api.leveling.ILeveledItem in project relics by SSKirillSS.

the class TooltipDescriptionHandler method getLevelingTooltip.

private static List<ITextComponent> getLevelingTooltip(ItemStack stack) {
    List<ITextComponent> tooltip = new ArrayList<>();
    if (!(stack.getItem() instanceof ILeveledItem))
        return tooltip;
    ILeveledItem item = (ILeveledItem) stack.getItem();
    int level = item.getLevel(stack);
    int currExp = item.getExperience(stack);
    int prevExp = item.getTotalExperienceForLevel(Math.max(level, level - 1));
    int nextExp = item.getTotalExperienceForLevel(item.getLevel(stack) + 1);
    tooltip.add((new StringTextComponent("   ◆ ").withStyle(TextFormatting.GREEN)).append((new TranslationTextComponent("tooltip.relics.shift.stats.level")).withStyle(TextFormatting.YELLOW)).append((new StringTextComponent(String.format("%d [%d/%d]", level, (currExp - prevExp), (nextExp - prevExp))).withStyle(TextFormatting.WHITE))));
    return tooltip;
}
Also used : ITextComponent(net.minecraft.util.text.ITextComponent) ArrayList(java.util.ArrayList) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) ILeveledItem(it.hurts.sskirillss.relics.api.leveling.ILeveledItem) StringTextComponent(net.minecraft.util.text.StringTextComponent)

Aggregations

ILeveledItem (it.hurts.sskirillss.relics.api.leveling.ILeveledItem)1 ArrayList (java.util.ArrayList)1 ITextComponent (net.minecraft.util.text.ITextComponent)1 StringTextComponent (net.minecraft.util.text.StringTextComponent)1 TranslationTextComponent (net.minecraft.util.text.TranslationTextComponent)1