From 9a2741128a78bb52eba50a631126e090a5a2abd8 Mon Sep 17 00:00:00 2001 From: miozune Date: Sat, 26 Nov 2022 01:45:28 +0900 Subject: Rewrite GUIs with ModularUI (#1381) * Base work for ModularUI compat * Remove useless interface * Add almost all the widgets * Invert method * Refactor NEI stack placement positions * NEI handlers on ModularUI * Add some more docs * AdvDebugStructureWriter * Fix NEI progressbar not working * PrimitiveBlastFurnace * clean * derp * clean * spotlessApply * Boilers * Buffers * clean * N by N slots containers * Fix boilers not having bucket interaction Put opening UI to individual MetaTEs * Maintenance Hatch * clean * spotlessApply * Add dependency * IndustrialApiary * Adapt to ModularUI change * Base work for covers & fix crash with MP * Fix crash with server * Rewrite base work for covers * Send initial cover data on cover GUI open so that the time of showing incorrect data will be eliminated * Covers part 1 * Rename package: ModularUI -> modularui * Rename class: GT_UIInfo -> GT_UIInfos * Fix build * Covers part2 * Fix missing client check with tile UI & fix title overlap * CoverTabLine * Move cover window creators to inner class * Fix crash with null base TE * Close GUI when tile is broken * Color cover window with tile colorization * Change signature of addUIWidgets * FluidFilter cover, FluidDisplaySlotWidget, BasicTank, BasicGenerator, Output Hatch, MicrowaveEnergyTransmitter, Teleporter, DigitalChest, DigitalTank * Add title tab * Move package: modularui -> modularui/widget * Programmed circuit + IConfigurationCircuitSupport * clean * VolumetricFlask * Remove integrated circuit overlay from recipe input slots * Input Hatch & Quadruple Input Hatch * Multiblock * Deprecate old cover GUI * BasicMachines * Finish BasicMachine & NEI * Expand DTPF NEI to 9 slots * Fix ME input bus on MP * Move AESlotWidget to public class * Move GT_Recipe_Map constructors with mNEIUnificateOutput to setter method * Move SteamTexture.Variant to outer enum * Switch to remote repository * oops * Update MUI * Update MUI * Minor refactor for change amount buttons * Display items and fluids that exceed usual count * blah * use +=, why didn't I do this * Update MUI * Move ModularUI to Base (#1510) * Move ModularUI to Base * Move most of the ModularUI functionality to `BaseTileEntity` (and `CoverableTileEntity`) * `CommonMetaTileEntity` delegates ato the MetaTileEntity * Added several interfaces (with defaults) to indicate if a tile/metatile override/implement certain behaviors. * Moved `IConfigurationCircuitSupport` interface such that it will work with BaseTileEntity or a MetaTileEntity * Address reviews Co-authored-by: miozune * Update MUI * Minor changes to NEI * Return :facepalm: * IGetTabIconSet override * Some more changes to NEI * Merge texture getter interfaces to new class GUITextureSet * Remove BBF structure picture as it's auto-buildable now * Make unified title tab style of texture angular * Expose some boiler texture getters for addon * Fix crash with cover GUI on pipe * Lower the number of recipe per page for DTPF & update MUI * Update MUI * Fix crash with middle-clicking slot on circuit selection GUI * Fix circuit selection window not syncing item from base machine * Merge GT_NEI_AssLineHandler into GT_NEI_DefaultHandler * Update MUI * Add in TecTech multi message * Allow changing the way of binding player inventory * Update MUI * Update MUI * Update MUI * Update MUI * Update MUI * Make MUI non-transitive to allow addons to use their own version * Force enable mixin * Format fluid amount tooltip * Add GUITextureSet.STEAM * Add guard against null ModularWindow creation * Add constructors for Muffler Hatch with inventory * Fix output slot on digital chest and tank allowing insertion * Don't log null ModularWindow * Add default implementation for IHasWorldObjectAndCoords#openGUI * Make openGTTileEntityUI accept MultiTE & cleanup Co-authored-by: Jason Mitchell --- .../api/gui/GT_GUIContainer_DigitalTank.java | 111 --------------------- 1 file changed, 111 deletions(-) delete mode 100644 src/main/java/gregtech/api/gui/GT_GUIContainer_DigitalTank.java (limited to 'src/main/java/gregtech/api/gui/GT_GUIContainer_DigitalTank.java') diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_DigitalTank.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_DigitalTank.java deleted file mode 100644 index 163aaa2929..0000000000 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_DigitalTank.java +++ /dev/null @@ -1,111 +0,0 @@ -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 net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -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); - 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) { - super(new GT_Container_DigitalTank(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "DigitalTank.png"); - mName = aName; - } - - @Override - 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 GT_Container_DigitalTank getContainer() { - return (GT_Container_DigitalTank) mContainer; - } - - @Override - protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { - fontRendererObj.drawString(mName, 8, 6, textColorTitle); - if (mContainer != null) { - fontRendererObj.drawString("Liquid Amount", 10, 20, textColor); - fontRendererObj.drawString( - GT_Utility.parseNumberToString(((GT_Container_DigitalTank) mContainer).mContent), - 10, - 30, - textColorValue); - } - } - - @Override - protected void drawGuiContainerBackgroundLayer(float parTicks, int mouseX, int mouseY) { - super.drawGuiContainerBackgroundLayer(parTicks, mouseX, mouseY); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - if (mContainer != null) { - if (((GT_Container_DigitalTank) mContainer).mLockFluid) { - drawTexturedModalRect(x + 25, y + 63, 176, 0, 18, 18); - } - if (((GT_Container_DigitalTank) mContainer).outputFluid) { - drawTexturedModalRect(x + 7, y + 63, 176, 18, 18, 18); - } - if (((GT_Container_DigitalTank) mContainer).mVoidFluidPart) { - drawTexturedModalRect(x + 151, y + 7, 176, 36, 18, 18); - } - if (((GT_Container_DigitalTank) mContainer).mVoidFluidFull) { - drawTexturedModalRect(x + 151, y + 25, 176, 54, 18, 18); - } - if (((GT_Container_DigitalTank) mContainer).mAllowInputFromOutputSide) { - drawTexturedModalRect(x + 43, y + 63, 176, 72, 18, 18); - } - } - } - - @Override - public boolean handleDragAndDropGT( - GuiContainer gui, int mousex, int mousey, ItemStack draggedStack, int button, boolean isGhost) { - if (!(gui instanceof GT_GUIContainer_DigitalTank) - || !((GT_GUIContainer_DigitalTank) gui).isMouseOverSlot(2, mousex, mousey) - || !isGhost) return false; - FluidStack fluidStack = GT_Utility.getFluidFromContainerOrFluidDisplay(draggedStack); - if (fluidStack == null) return false; - IGregTechTileEntity te = ((GT_GUIContainer_DigitalTank) gui).mContainer.mTileEntity; - GT_MetaTileEntity_DigitalTankBase mte = (GT_MetaTileEntity_DigitalTankBase) te.getMetaTileEntity(); - if (mte == null || !mte.allowChangingLockedFluid(fluidStack.getFluid().getName())) return false; - - GT_Values.NW.sendToServer(new GT_Packet_SetLockedFluid(te, fluidStack)); - draggedStack.stackSize = 0; - // propagate to client too - mte.setLockedFluidName(fluidStack.getFluid().getName()); - return true; - } -} -- cgit