Ensure the tooltip actually is found by using the translate key instead of Display name to avoid issues with items that have been renamed.

This commit is contained in:
alexbegt committed 2019-08-16 19:11:47 -04:00
1 parent 8d2419f61a
commit 606a588a4e
2 files changed
+3 -6

No files matched your search

@@ -24,10 +24,7 @@ public class BlockTooltipItem extends BlockItem {
@Override
@OnlyIn(Dist.CLIENT)
public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
if (I18n.hasKey(stack.getDisplayName()+ ".tooltip")) {
tooltip.addAll(LocUtils.getTooltips(TextFormatting.GRAY.toString() + LocUtils.translateRecursive(stack.getDisplayName() + ".tooltip")));
}
TooltipItem.addOptionalTooltip(stack, tooltip);
super.addInformation(stack, worldIn, tooltip, flagIn);
}
}
@@ -29,8 +29,8 @@ public class TooltipItem extends Item {
}
public static void addOptionalTooltip(ItemStack stack, List<ITextComponent> tooltip) {
if (I18n.hasKey(stack.getDisplayName() + ".tooltip")) {
tooltip.addAll(LocUtils.getTooltips(TextFormatting.GRAY.toString() + LocUtils.translateRecursive(stack.getDisplayName() + ".tooltip")));
if (I18n.hasKey(stack.getTranslationKey() + ".tooltip")) {
tooltip.addAll(LocUtils.getTooltips(TextFormatting.GRAY.toString() + LocUtils.translateRecursive(stack.getTranslationKey() + ".tooltip")));
}
}
}