diff options
Diffstat (limited to 'src/main/java/gregtech/api/gui/GT_GUIContainer_DigitalTank.java')
-rw-r--r-- | src/main/java/gregtech/api/gui/GT_GUIContainer_DigitalTank.java | 61 |
1 files changed, 24 insertions, 37 deletions
diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_DigitalTank.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_DigitalTank.java index 08248b5333..163aaa2929 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_DigitalTank.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_DigitalTank.java @@ -3,25 +3,30 @@ package gregtech.api.gui; import static gregtech.api.enums.GT_Values.RES_PATH_GUI; import gregtech.api.enums.GT_Values; +import gregtech.api.gui.widgets.GT_GuiSlotTooltip; import gregtech.api.interfaces.IDragAndDropSupport; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.net.GT_Packet_SetLockedFluid; import gregtech.api.util.GT_Utility; import gregtech.common.tileentities.storage.GT_MetaTileEntity_DigitalTankBase; -import java.util.ArrayList; -import java.util.List; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; import net.minecraftforge.fluids.FluidStack; public class GT_GUIContainer_DigitalTank extends GT_GUIContainerMetaTile_Machine implements IDragAndDropSupport { private final String mName; - private final int textColor = this.getTextColorOrDefault("text", 0xFAFAFF), - textColorTitle = this.getTextColorOrDefault("title", 0x404040), - textColorValue = this.getTextColorOrDefault("value", 0xFAFAFF); + private final int textColor = this.getTextColorOrDefault("text", 0xFAFAFF); + private final int textColorTitle = this.getTextColorOrDefault("title", 0x404040); + private final int textColorValue = this.getTextColorOrDefault("value", 0xFAFAFF); + + private static final String DIGITALTANK_AUTOOUTPUT_TOOLTIP = "GT5U.machines.digitaltank.autooutput.tooltip"; + private static final String DIGITALTANK_LOCKFLUID_TOOLTIP = "GT5U.machines.digitaltank.lockfluid.tooltip"; + private static final String DIGITALTANK_VOIDOVERFLOW_TOOLTIP = "GT5U.machines.digitaltank.voidoverflow.tooltip"; + private static final String DIGITALTANK_VOIDFULL_TOOLTIP = "GT5U.machines.digitaltank.voidfull.tooltip"; + private static final String DIGITALTANK_INPUTFROMOUTPUT_TOOLTIP = + "GT5U.machines.digitaltank.inputfromoutput.tooltip"; public GT_GUIContainer_DigitalTank( InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { @@ -30,39 +35,21 @@ public class GT_GUIContainer_DigitalTank extends GT_GUIContainerMetaTile_Machine } @Override - public void drawScreen(int par1, int par2, float par3) { - super.drawScreen(par1, par2, par3); - drawTooltip(par1, par2); + protected void setupTooltips() { + addToolTip(new GT_GuiSlotTooltip( + getContainer().slotAutoOutput, mTooltipCache.getData(DIGITALTANK_AUTOOUTPUT_TOOLTIP))); + addToolTip(new GT_GuiSlotTooltip( + getContainer().slotLockFLuid, mTooltipCache.getData(DIGITALTANK_LOCKFLUID_TOOLTIP))); + addToolTip(new GT_GuiSlotTooltip( + getContainer().slotVoidOverFlow, mTooltipCache.getData(DIGITALTANK_VOIDOVERFLOW_TOOLTIP))); + addToolTip(new GT_GuiSlotTooltip( + getContainer().slotVoidFull, mTooltipCache.getData(DIGITALTANK_VOIDFULL_TOOLTIP))); + addToolTip(new GT_GuiSlotTooltip( + getContainer().slotInputFromOutput, mTooltipCache.getData(DIGITALTANK_INPUTFROMOUTPUT_TOOLTIP))); } - private void drawTooltip(int x2, int y2) { - int xStart = (width - xSize) / 2; - int yStart = (height - ySize) / 2; - int x = x2 - xStart; - int y = y2 - yStart + 5; - List<String> list = new ArrayList<>(); - if (y >= 68 && y <= 84) { - if (x >= 8 && x <= 24) { - list.add(StatCollector.translateToLocal("GT5U.machines.digitaltank.autooutput.name")); - } else if (x >= 26 && x <= 42) { - list.add(StatCollector.translateToLocal("GT5U.machines.digitaltank.lockfluid.name")); - list.add(StatCollector.translateToLocal("GT5U.machines.digitaltank.lockfluid.tooltip")); - list.add(StatCollector.translateToLocal("GT5U.machines.digitaltank.lockfluid.tooltip1")); - } - if (x >= 44 && x <= 60) { - list.add(StatCollector.translateToLocal("GT5U.machines.digitaltank.inputfromoutput.name")); - } - } else if (x >= 152 && x <= 168) { - if (y >= 12 && y <= 28) { - list.add(StatCollector.translateToLocal("GT5U.machines.digitaltank.voidoverflow.name")); - list.add(StatCollector.translateToLocal("GT5U.machines.digitaltank.voidoverflow.tooltip")); - } - if (y >= 30 && y <= 46) { - list.add(StatCollector.translateToLocal("GT5U.machines.digitaltank.voidfull.name")); - list.add(StatCollector.translateToLocal("GT5U.machines.digitaltank.voidfull.tooltip")); - } - } - if (!list.isEmpty()) drawHoveringText(list, x2, y2, fontRendererObj); + private GT_Container_DigitalTank getContainer() { + return (GT_Container_DigitalTank) mContainer; } @Override |