mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-22 05:02:11 +00:00
Co-authored-by: slprime <[email protected]>
This commit is contained in:
1 parent
f922d7ef1e
commit
651b59cba9
5 files changed
+42
-12
No files matched your search
@@ -19,12 +19,21 @@ import codechicken.nei.recipe.Recipe.RecipeId;
|
||||
|
||||
public class RecipeItemInputHandler implements IContainerInputHandler, IContainerTooltipHandler {
|
||||
|
||||
public static final RecipeItemInputHandler instance = new RecipeItemInputHandler();
|
||||
|
||||
protected RecipeTooltipLineHandler recipeTooltipLineHandler = null;
|
||||
|
||||
protected RecipeItemInputHandler() {
|
||||
|
||||
}
|
||||
|
||||
public static void load() {
|
||||
RecipeItemInputHandler recipeHandler = new RecipeItemInputHandler();
|
||||
GuiContainerManager.addInputHandler(recipeHandler);
|
||||
GuiContainerManager.addTooltipHandler(recipeHandler);
|
||||
GuiContainerManager.addInputHandler(instance);
|
||||
GuiContainerManager.addTooltipHandler(instance);
|
||||
}
|
||||
|
||||
public void clearTooltipCache() {
|
||||
this.recipeTooltipLineHandler = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,16 +73,17 @@ public class RecipeItemInputHandler implements IContainerInputHandler, IContaine
|
||||
: null;
|
||||
|
||||
if (recipeId == null) {
|
||||
recipeTooltipLineHandler = null;
|
||||
} else if (recipeTooltipLineHandler == null || !recipeTooltipLineHandler.getRecipeId().equals(recipeId)) {
|
||||
recipeTooltipLineHandler = new RecipeTooltipLineHandler(recipeId);
|
||||
}
|
||||
clearTooltipCache();
|
||||
} else if (this.recipeTooltipLineHandler == null
|
||||
|| !this.recipeTooltipLineHandler.getRecipeId().equals(recipeId)) {
|
||||
this.recipeTooltipLineHandler = new RecipeTooltipLineHandler(recipeId);
|
||||
}
|
||||
|
||||
if (recipeTooltipLineHandler != null) {
|
||||
currenttip.add(GuiDraw.TOOLTIP_HANDLER + GuiDraw.getTipLineId(recipeTooltipLineHandler));
|
||||
if (this.recipeTooltipLineHandler != null) {
|
||||
currenttip.add(GuiDraw.TOOLTIP_HANDLER + GuiDraw.getTipLineId(this.recipeTooltipLineHandler));
|
||||
}
|
||||
} else {
|
||||
recipeTooltipLineHandler = null;
|
||||
clearTooltipCache();
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
|
||||
Reference in new issue
Block a user