Skip to content

Commit

Permalink
Fix name showing twice if JEI disables the mod name (#5023)
Browse files Browse the repository at this point in the history
  • Loading branch information
KnightMiner committed Nov 24, 2022
1 parent 50a9b96 commit 2e12737
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ default void onTooltip(IRecipeSlotView recipeSlotView, List<Component> tooltip)
tooltip.clear();
tooltip.add(name);
addMiddleLines(recipeSlotView, tooltip);
tooltip.add(modId);
// only add last line if we actually have mod IDs
if (JEIPlugin.modIdHelper != null && JEIPlugin.modIdHelper.isDisplayingModNameEnabled()) {
tooltip.add(modId);
}
}

/** Adds the lines between the name and mod ID */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import mezz.jei.api.forge.ForgeTypes;
import mezz.jei.api.gui.handlers.IGuiContainerHandler;
import mezz.jei.api.helpers.IGuiHelper;
import mezz.jei.api.helpers.IModIdHelper;
import mezz.jei.api.ingredients.subtypes.IIngredientSubtypeInterpreter;
import mezz.jei.api.ingredients.subtypes.UidContext;
import mezz.jei.api.registration.IGuiHandlerRegistration;
Expand Down Expand Up @@ -110,6 +111,8 @@
@SuppressWarnings("unused")
@JeiPlugin
public class JEIPlugin implements IModPlugin {
public static IModIdHelper modIdHelper;

@Override
public ResourceLocation getPluginUid() {
return TConstructJEIConstants.PLUGIN;
Expand Down Expand Up @@ -397,6 +400,7 @@ public void onRuntimeAvailable(IJeiRuntime jeiRuntime) {
optionalCast(manager, TinkerSmeltery.coinCast);
optionalCast(manager, TinkerSmeltery.wireCast);
optionalItem(manager, TinkerMaterials.necroniumBone, "ingots/uranium");
modIdHelper = jeiRuntime.getJeiHelpers().getModIdHelper();
}

/** Class to pass {@link IScreenWithFluidTank} into JEI */
Expand Down

0 comments on commit 2e12737

Please sign in to comment.