diff --git a/src/main/java/com/darkona/adventurebackpack/client/gui/GuiAdvBackpack.java b/src/main/java/com/darkona/adventurebackpack/client/gui/GuiAdvBackpack.java index c43bcc28..c94ed5a8 100644 --- a/src/main/java/com/darkona/adventurebackpack/client/gui/GuiAdvBackpack.java +++ b/src/main/java/com/darkona/adventurebackpack/client/gui/GuiAdvBackpack.java @@ -191,7 +191,9 @@ public void updateScreen() } } - + /** + * An instance of this class will handle tooltips for all instances of GuiAdvBackpack + */ public static class TooltipHandler implements IContainerTooltipHandler { @@ -203,7 +205,7 @@ public List handleTooltip(GuiContainer gui, int mouseX, int mouseY, List GuiWithTanks backpackGui = (GuiWithTanks) gui; // Fluid tank tooltips - if (ConfigHandler.tanksHoveringText && GuiContainerManager.shouldShowTooltip(gui) && currenttip.size() == 0) + if (GuiContainerManager.shouldShowTooltip(gui) && currenttip.size() == 0) { if (tankLeft.inTank(backpackGui, mouseX, mouseY)) currenttip.addAll(tankLeft.getTankTooltip()); @@ -234,7 +236,9 @@ public List handleItemTooltip(GuiContainer gui, ItemStack itemstack, int } static { - // Creating a single instance of TooltipHandler to handle tooltips for all instances of GuiAdvBackpack - GuiContainerManager.addTooltipHandler(new TooltipHandler()); + // Only instantiate TooltipHandler if enabled in config. + if (ConfigHandler.tanksHoveringText) { + GuiContainerManager.addTooltipHandler(new TooltipHandler()); + } } }