From 63518f913cb55af72f8420d39f95344f62fa1d1a Mon Sep 17 00:00:00 2001 From: Integer Limit <103940576+IntegerLimit@users.noreply.github.com> Date: Sat, 12 Oct 2024 06:32:36 +1100 Subject: [PATCH] More Tweaker Information in JEI Recipe Display (#2638) --- .../jei/recipe/GTRecipeWrapper.java | 27 +++++++++++++++---- .../resources/assets/gregtech/lang/en_us.lang | 4 +++ 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java b/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java index 7dae031a66a..4d88c1f1e5b 100644 --- a/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java @@ -23,6 +23,7 @@ import gregtech.api.util.AssemblyLineManager; import gregtech.api.util.ClipboardUtil; import gregtech.api.util.GTUtility; +import gregtech.api.util.LocalizationUtils; import gregtech.api.util.TextFormattingUtil; import gregtech.client.utils.TooltipHelper; import gregtech.integration.RecipeCompatUtil; @@ -309,15 +310,22 @@ public List getTooltipStrings(int mouseX, int mouseY) { @Override public void initExtras() { - // do not add the X button if no tweaker mod is present + // do not add the info or X button if no tweaker mod is present if (!RecipeCompatUtil.isTweakerLoaded()) return; - BooleanSupplier creativePlayerCtPredicate = () -> Minecraft.getMinecraft().player != null && + BooleanSupplier creativePlayerPredicate = () -> Minecraft.getMinecraft().player != null && Minecraft.getMinecraft().player.isCreative(); + BooleanSupplier creativeTweaker = () -> creativePlayerPredicate.getAsBoolean() && + (recipe.getIsCTRecipe() || recipe.isGroovyRecipe()); + BooleanSupplier creativeDefault = () -> creativePlayerPredicate.getAsBoolean() && !recipe.getIsCTRecipe() && + !recipe.isGroovyRecipe(); + + // X Button buttons.add(new JeiButton(166, 2, 10, 10) .setTextures(GuiTextures.BUTTON_CLEAR_GRID) - .setTooltipBuilder(lines -> lines.add("Copies a " + RecipeCompatUtil.getTweakerName() + - " script, to remove this recipe, to the clipboard")) + .setTooltipBuilder(lines -> lines.add( + LocalizationUtils.format("gregtech.jei.remove_recipe.tooltip", + RecipeCompatUtil.getTweakerName()))) .setClickAction((minecraft, mouseX, mouseY, mouseButton) -> { String recipeLine = RecipeCompatUtil.getRecipeRemoveLine(recipeMap, recipe); String output = RecipeCompatUtil.getFirstOutputString(recipe); @@ -330,7 +338,16 @@ public void initExtras() { new TextComponentString("Copied [\u00A76" + recipeLine + "\u00A7r] to the clipboard")); return true; }) - .setActiveSupplier(creativePlayerCtPredicate)); + .setActiveSupplier(creativeDefault)); + + // CT/GS Info + buttons.add(new JeiButton(166, 2, 10, 10) + .setTextures(GuiTextures.INFO_ICON) + .setTooltipBuilder(lines -> lines.add(recipe.isGroovyRecipe() ? + LocalizationUtils.format("gregtech.jei.gs_recipe.tooltip") : + LocalizationUtils.format("gregtech.jei.ct_recipe.tooltip"))) + .setClickAction((mc, x, y, button) -> false) + .setActiveSupplier(creativeTweaker)); } public ChancedItemOutput getOutputChance(int slot) { diff --git a/src/main/resources/assets/gregtech/lang/en_us.lang b/src/main/resources/assets/gregtech/lang/en_us.lang index 57813ab590a..4b6a49481b6 100644 --- a/src/main/resources/assets/gregtech/lang/en_us.lang +++ b/src/main/resources/assets/gregtech/lang/en_us.lang @@ -39,6 +39,10 @@ death.attack.screwdriver_lv=%s had their screws removed by %s enchantment.disjunction=Disjunction +gregtech.jei.remove_recipe.tooltip=Copies a %s Snippet to Remove this Recipe +gregtech.jei.ct_recipe.tooltip=CraftTweaker Recipe +gregtech.jei.gs_recipe.tooltip=GroovyScript Recipe + gregtech.machine.steam_grinder.name=Steam Grinder gregtech.multiblock.steam_grinder.description=A Multiblock Macerator at the Steam Age. Requires at least 14 Bronze Casings to form. Cannot use normal Input/Output busses, nor Fluid Hatches other than the Steam Hatch. gregtech.multiblock.steam.low_steam=Not enough Steam to run!