From 20d1403eded0c77fa32a2fc642fc5dc1ba1a45ba Mon Sep 17 00:00:00 2001 From: grimmauld Date: Tue, 17 Nov 2020 14:58:48 +0100 Subject: [PATCH] Fix getUnformattedDeepText breaking with translation text components, which resulted in double tooltip text --- .../create/foundation/item/TooltipHelper.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java b/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java index eb7f51306..97289b831 100644 --- a/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java +++ b/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java @@ -29,12 +29,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.TieredItem; import net.minecraft.util.IItemProvider; -import net.minecraft.util.text.IFormattableTextComponent; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.Style; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.util.text.TextProcessing; +import net.minecraft.util.text.*; public class TooltipHelper { @@ -284,11 +279,10 @@ public class TooltipHelper { public static String getUnformattedDeepText(ITextComponent component) { StringBuilder b = new StringBuilder(); - b.append(component.getString()); + if (!(component instanceof TranslationTextComponent)) + b.append(component.getString()); component.getSiblings() - .forEach(c -> { - b.append(getUnformattedDeepText(c)); - }); + .forEach(c -> b.append(getUnformattedDeepText(c))); return b.toString(); }