Skip to content

Commit

Permalink
Fix #1238 Mod Name drawn for recipe tabs when disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
mezz committed May 22, 2018
1 parent bd8ff72 commit b28c2cb
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/main/java/mezz/jei/gui/recipes/RecipeCategoryTab.java
Expand Up @@ -90,7 +90,9 @@ public List<String> getTooltip() {
String modName = LegacyUtil.getModName(category);
if (modName != null) {
modName = ForgeModIdHelper.getInstance().getFormattedModNameForModId(modName);
tooltip.add(modName);
if (modName != null) {
tooltip.add(modName);
}
}
return tooltip;
}
Expand Down
Expand Up @@ -118,7 +118,9 @@ public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper,

if (modIdDifferent) {
String modName = ForgeModIdHelper.getInstance().getFormattedModNameForModId(recipeModId);
tooltip.add(TextFormatting.GRAY + Translator.translateToLocalFormatted("jei.tooltip.recipe.by", modName));
if (modName != null) {
tooltip.add(TextFormatting.GRAY + Translator.translateToLocalFormatted("jei.tooltip.recipe.by", modName));
}
}

boolean showAdvanced = Minecraft.getMinecraft().gameSettings.advancedItemTooltips || GuiScreen.isShiftKeyDown();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/mezz/jei/startup/AbstractModIdHelper.java
Expand Up @@ -32,6 +32,9 @@ public <T> List<String> addModNameToIngredientTooltip(List<String> tooltip, T in

String modId = ingredientHelper.getDisplayModId(ingredient);
String modName = getFormattedModNameForModId(modId);
if (modName == null) {
return tooltip;
}
List<String> tooltipCopy = new ArrayList<>(tooltip);
tooltipCopy.add(modName);
return tooltipCopy;
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/mezz/jei/startup/ForgeModIdHelper.java
Expand Up @@ -50,6 +50,9 @@ public String getModNameForModId(String modId) {
@Override
public String getFormattedModNameForModId(String modId) {
String modNameFormat = Config.getModNameFormat();
if (modNameFormat.isEmpty()) {
return null;
}
String modName = getModNameForModId(modId);
modName = removeChatFormatting(modName); // some crazy mod has formatting in the name
if (modNameFormat.contains(MOD_NAME_FORMAT_CODE)) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/mezz/jei/startup/IModIdHelper.java
Expand Up @@ -9,6 +9,7 @@
public interface IModIdHelper {
String getModNameForModId(String modId);

@Nullable
String getFormattedModNameForModId(String modId);

<T> String getModNameForIngredient(T ingredient, IIngredientHelper<T> ingredientHelper);
Expand Down

0 comments on commit b28c2cb

Please sign in to comment.