Skip to content

Commit 63518f9

Browse files
authored
More Tweaker Information in JEI Recipe Display (#2638)
1 parent 869be2a commit 63518f9

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import gregtech.api.util.AssemblyLineManager;
2424
import gregtech.api.util.ClipboardUtil;
2525
import gregtech.api.util.GTUtility;
26+
import gregtech.api.util.LocalizationUtils;
2627
import gregtech.api.util.TextFormattingUtil;
2728
import gregtech.client.utils.TooltipHelper;
2829
import gregtech.integration.RecipeCompatUtil;
@@ -309,15 +310,22 @@ public List<String> getTooltipStrings(int mouseX, int mouseY) {
309310

310311
@Override
311312
public void initExtras() {
312-
// do not add the X button if no tweaker mod is present
313+
// do not add the info or X button if no tweaker mod is present
313314
if (!RecipeCompatUtil.isTweakerLoaded()) return;
314315

315-
BooleanSupplier creativePlayerCtPredicate = () -> Minecraft.getMinecraft().player != null &&
316+
BooleanSupplier creativePlayerPredicate = () -> Minecraft.getMinecraft().player != null &&
316317
Minecraft.getMinecraft().player.isCreative();
318+
BooleanSupplier creativeTweaker = () -> creativePlayerPredicate.getAsBoolean() &&
319+
(recipe.getIsCTRecipe() || recipe.isGroovyRecipe());
320+
BooleanSupplier creativeDefault = () -> creativePlayerPredicate.getAsBoolean() && !recipe.getIsCTRecipe() &&
321+
!recipe.isGroovyRecipe();
322+
323+
// X Button
317324
buttons.add(new JeiButton(166, 2, 10, 10)
318325
.setTextures(GuiTextures.BUTTON_CLEAR_GRID)
319-
.setTooltipBuilder(lines -> lines.add("Copies a " + RecipeCompatUtil.getTweakerName() +
320-
" script, to remove this recipe, to the clipboard"))
326+
.setTooltipBuilder(lines -> lines.add(
327+
LocalizationUtils.format("gregtech.jei.remove_recipe.tooltip",
328+
RecipeCompatUtil.getTweakerName())))
321329
.setClickAction((minecraft, mouseX, mouseY, mouseButton) -> {
322330
String recipeLine = RecipeCompatUtil.getRecipeRemoveLine(recipeMap, recipe);
323331
String output = RecipeCompatUtil.getFirstOutputString(recipe);
@@ -330,7 +338,16 @@ public void initExtras() {
330338
new TextComponentString("Copied [\u00A76" + recipeLine + "\u00A7r] to the clipboard"));
331339
return true;
332340
})
333-
.setActiveSupplier(creativePlayerCtPredicate));
341+
.setActiveSupplier(creativeDefault));
342+
343+
// CT/GS Info
344+
buttons.add(new JeiButton(166, 2, 10, 10)
345+
.setTextures(GuiTextures.INFO_ICON)
346+
.setTooltipBuilder(lines -> lines.add(recipe.isGroovyRecipe() ?
347+
LocalizationUtils.format("gregtech.jei.gs_recipe.tooltip") :
348+
LocalizationUtils.format("gregtech.jei.ct_recipe.tooltip")))
349+
.setClickAction((mc, x, y, button) -> false)
350+
.setActiveSupplier(creativeTweaker));
334351
}
335352

336353
public ChancedItemOutput getOutputChance(int slot) {

src/main/resources/assets/gregtech/lang/en_us.lang

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ death.attack.screwdriver_lv=%s had their screws removed by %s
3939

4040
enchantment.disjunction=Disjunction
4141

42+
gregtech.jei.remove_recipe.tooltip=Copies a %s Snippet to Remove this Recipe
43+
gregtech.jei.ct_recipe.tooltip=CraftTweaker Recipe
44+
gregtech.jei.gs_recipe.tooltip=GroovyScript Recipe
45+
4246
gregtech.machine.steam_grinder.name=Steam Grinder
4347
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.
4448
gregtech.multiblock.steam.low_steam=Not enough Steam to run!

0 commit comments

Comments
 (0)