From c34df619c089a456fff298c2a0c665449758bfa6 Mon Sep 17 00:00:00 2001 From: bconlon Date: Wed, 25 Jan 2023 20:00:41 -0800 Subject: [PATCH] Use creative TooltipFlags for JEI Menus instead of non-creative ones, similar to the Creative Menu as of 1.19.3 --- .../main/java/mezz/jei/common/util/IngredientTooltipHelper.java | 1 + .../src/main/java/mezz/jei/fabric/platform/ItemStackHelper.java | 2 +- .../src/main/java/mezz/jei/forge/platform/ItemStackHelper.java | 2 +- Forge/src/test/java/mezz/jei/test/IngredientFilterTest.java | 2 +- .../mezz/jei/gui/ingredients/IngredientInformationUtil.java | 1 + 5 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Common/src/main/java/mezz/jei/common/util/IngredientTooltipHelper.java b/Common/src/main/java/mezz/jei/common/util/IngredientTooltipHelper.java index ed84d4d1e..6b33e3225 100644 --- a/Common/src/main/java/mezz/jei/common/util/IngredientTooltipHelper.java +++ b/Common/src/main/java/mezz/jei/common/util/IngredientTooltipHelper.java @@ -20,6 +20,7 @@ public static List getMutableIngredientTooltipSafe(V ingredient, try { Minecraft minecraft = Minecraft.getInstance(); TooltipFlag.Default tooltipFlag = minecraft.options.advancedItemTooltips ? TooltipFlag.Default.ADVANCED : TooltipFlag.Default.NORMAL; + tooltipFlag = tooltipFlag.asCreative(); List tooltip = ingredientRenderer.getTooltip(ingredient, tooltipFlag); return new ArrayList<>(tooltip); } catch (RuntimeException | LinkageError e) { diff --git a/Fabric/src/main/java/mezz/jei/fabric/platform/ItemStackHelper.java b/Fabric/src/main/java/mezz/jei/fabric/platform/ItemStackHelper.java index 21374ad5a..8f0aa0a20 100644 --- a/Fabric/src/main/java/mezz/jei/fabric/platform/ItemStackHelper.java +++ b/Fabric/src/main/java/mezz/jei/fabric/platform/ItemStackHelper.java @@ -35,7 +35,7 @@ public Optional getCreatorModId(ItemStack stack) { @Override public List getTestTooltip(@Nullable Player player, ItemStack itemStack) { try { - return itemStack.getTooltipLines(player, TooltipFlag.Default.NORMAL); + return itemStack.getTooltipLines(player, TooltipFlag.Default.NORMAL.asCreative()); } catch (LinkageError | RuntimeException e) { LOGGER.error("Error while Testing for mod name formatting", e); } diff --git a/Forge/src/main/java/mezz/jei/forge/platform/ItemStackHelper.java b/Forge/src/main/java/mezz/jei/forge/platform/ItemStackHelper.java index 8b46d7dca..cdc5258c5 100644 --- a/Forge/src/main/java/mezz/jei/forge/platform/ItemStackHelper.java +++ b/Forge/src/main/java/mezz/jei/forge/platform/ItemStackHelper.java @@ -50,7 +50,7 @@ public List getTestTooltip(@Nullable Player player, ItemStack itemSta try { List tooltip = new ArrayList<>(); tooltip.add(Component.literal("JEI Tooltip Testing for mod name formatting")); - ItemTooltipEvent tooltipEvent = ForgeEventFactory.onItemTooltip(itemStack, player, tooltip, TooltipFlag.Default.NORMAL); + ItemTooltipEvent tooltipEvent = ForgeEventFactory.onItemTooltip(itemStack, player, tooltip, TooltipFlag.Default.NORMAL.asCreative()); return tooltipEvent.getToolTip(); } catch (LinkageError | RuntimeException e) { LOGGER.error("Error while Testing for mod name formatting", e); diff --git a/Forge/src/test/java/mezz/jei/test/IngredientFilterTest.java b/Forge/src/test/java/mezz/jei/test/IngredientFilterTest.java index 61f913406..78ee13211 100644 --- a/Forge/src/test/java/mezz/jei/test/IngredientFilterTest.java +++ b/Forge/src/test/java/mezz/jei/test/IngredientFilterTest.java @@ -180,7 +180,7 @@ public void testConfigBlacklist() { } public static List getTooltipStrings(IIngredientRenderer ingredientRenderer, TestIngredient testIngredient) { - List tooltip = ingredientRenderer.getTooltip(testIngredient, TooltipFlag.Default.NORMAL); + List tooltip = ingredientRenderer.getTooltip(testIngredient, TooltipFlag.Default.NORMAL.asCreative()); return tooltip.stream() .map(Component::getString) .map(Translator::toLowercaseWithLocale) diff --git a/Gui/src/main/java/mezz/jei/gui/ingredients/IngredientInformationUtil.java b/Gui/src/main/java/mezz/jei/gui/ingredients/IngredientInformationUtil.java index cfff26513..1d0411750 100644 --- a/Gui/src/main/java/mezz/jei/gui/ingredients/IngredientInformationUtil.java +++ b/Gui/src/main/java/mezz/jei/gui/ingredients/IngredientInformationUtil.java @@ -25,6 +25,7 @@ public static String getDisplayName(T ingredient, IIngredientHelper ingre @Unmodifiable public static List getTooltipStrings(T ingredient, IIngredientRenderer ingredientRenderer, Set toRemove, IIngredientFilterConfig config) { TooltipFlag.Default tooltipFlag = config.getSearchAdvancedTooltips() ? TooltipFlag.Default.ADVANCED : TooltipFlag.Default.NORMAL; + tooltipFlag = tooltipFlag.asCreative(); List tooltip = ingredientRenderer.getTooltip(ingredient, tooltipFlag); return tooltip.stream() .map(Component::getString)