use of it.hurts.sskirillss.relics.client.tooltip.base.RelicTooltip 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;
}
use of it.hurts.sskirillss.relics.client.tooltip.base.RelicTooltip in project relics by SSKirillSS.
the class TooltipBorderHandler method getBorderColors.
@Nullable
private static Pair<String, String> getBorderColors(ItemStack stack) {
if (!(stack.getItem() instanceof RelicItem))
return null;
RelicItem<?> relic = (RelicItem<?>) stack.getItem();
RelicTooltip tooltip = relic.getTooltip(stack);
if (tooltip == null)
return null;
return tooltip.getBorders();
}
Aggregations