Skip to content

Commit

Permalink
fix tooltip problem
Browse files Browse the repository at this point in the history
(cherry picked from commit e467ff8)
  • Loading branch information
vfyjxf authored and Dream-Master committed Feb 7, 2022
1 parent 15a6344 commit ecfefdf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ public void onDrawScreen(GuiScreenEvent.DrawScreenEvent.Post event) {
if (this.isCraftingTerm || this.isPatternTerm) {
GuiRecipe gui = (GuiRecipe) event.gui;

if (gui.getHandler() != null && NEECraftingHandler.isCraftingTableRecipe(gui.getHandler())) {
IRecipeHandler currentHandler = gui.currenthandlers.get(gui.recipetype);

if (NEECraftingHandler.isCraftingTableRecipe(currentHandler)) {

if (this.trackerMap.isEmpty()) {
initIngredientTracker(gui);
Expand Down Expand Up @@ -208,11 +210,11 @@ private void drawCraftingHelperTooltip(GuiRecipe guiRecipe, int mouseX, int mous
if (this.drawRequestTooltip) {
if (NEECraftingHelper.isIsPatternInterfaceExists()) {
tooltips.add(String.format("%s" + EnumChatFormatting.GRAY + " + " +
EnumChatFormatting.BLUE + I18n.format("neenergistics.gui.tooltip.helper.crafting.text1"),
EnumChatFormatting.BLUE + I18n.format("neenergistics.gui.tooltip.helper.crafting.text2"),
EnumChatFormatting.YELLOW + Keyboard.getKeyName(NEIClientConfig.getKeyBinding("nee.preview"))));
} else {
tooltips.add(String.format("%s" + EnumChatFormatting.GRAY + " + " +
EnumChatFormatting.BLUE + I18n.format("neenergistics.gui.tooltip.helper.crafting.text2"),
EnumChatFormatting.BLUE + I18n.format("neenergistics.gui.tooltip.helper.crafting.text1"),
EnumChatFormatting.YELLOW + Keyboard.getKeyName(NEIClientConfig.getKeyBinding("nee.preview"))));
}
}
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ public class NEECraftingHandler implements IOverlayHandler {
public static final NEECraftingHandler INSTANCE = new NEECraftingHandler();

public static boolean isCraftingTableRecipe(IRecipeHandler recipe) {
TemplateRecipeHandler templateRecipeHandler = (TemplateRecipeHandler) recipe;
String overlayIdentifier = templateRecipeHandler.getOverlayIdentifier();
return "crafting".equals(overlayIdentifier) || "crafting2x2".equals(overlayIdentifier);
if (recipe instanceof TemplateRecipeHandler) {
TemplateRecipeHandler templateRecipeHandler = (TemplateRecipeHandler) recipe;
String overlayIdentifier = templateRecipeHandler.getOverlayIdentifier();
return "crafting".equals(overlayIdentifier) || "crafting2x2".equals(overlayIdentifier);
} else {
return false;
}
}

@Override
Expand Down

0 comments on commit ecfefdf

Please sign in to comment.