use of it.hurts.sskirillss.relics.client.tooltip.base.AbilityTooltip in project relics by SSKirillSS.
the class TooltipDescriptionHandler method getAbilitiesTooltip.
private static List<ITextComponent> getAbilitiesTooltip(ItemStack stack) {
List<ITextComponent> tooltip = new ArrayList<>();
if (!(stack.getItem() instanceof RelicItem))
return tooltip;
RelicItem<?> relic = (RelicItem<?>) stack.getItem();
RelicTooltip data = relic.getTooltip(stack);
if (data == null)
return tooltip;
List<AbilityTooltip> abilities = data.getAbilities();
if (abilities.isEmpty())
return tooltip;
for (int i = 0; i < abilities.size(); i++) {
AbilityTooltip ability = abilities.get(i);
String path = "tooltip." + Reference.MODID + "." + Objects.requireNonNull(relic.getRegistryName()).getPath() + ".ability." + (i + 1) + ".";
String key = ability.getKeybinding();
tooltip.add((new StringTextComponent(" ◆ ").withStyle(ability.isNegative() ? TextFormatting.RED : TextFormatting.GREEN)).append((new TranslationTextComponent(path + "name")).withStyle(TextFormatting.YELLOW)).append((new StringTextComponent(key == null ? "" : String.format(" [%s]", key)).withStyle(TextFormatting.DARK_GRAY))).append((new StringTextComponent(" - ").withStyle(TextFormatting.WHITE))).append(new TranslationTextComponent(path + "description", ability.getArgs().toArray(new Object[0])).withStyle(TextFormatting.GRAY)));
}
return tooltip;
}
Aggregations