diff options
| author | miozune <miozune@gmail.com> | 2022-09-02 20:57:30 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-02 13:57:30 +0200 |
| commit | 41d1832928fb89accc49b384ddec71375daaed71 (patch) | |
| tree | cb2cc16e52458a892b2798f28c3305d3b3f05a9f /src/main/java/gregtech/common/gui | |
| parent | 233b0f321a0d0b9594f6e0f55dd0d7ae789f9c31 (diff) | |
| download | GT5-Unofficial-41d1832928fb89accc49b384ddec71375daaed71.tar.gz GT5-Unofficial-41d1832928fb89accc49b384ddec71375daaed71.tar.bz2 GT5-Unofficial-41d1832928fb89accc49b384ddec71375daaed71.zip | |
Add Drag-And-Drop support for digital tank (#1333)
* Add Drag-And-Drop support for digital tank
* lockedFluidName is null in old save
Diffstat (limited to 'src/main/java/gregtech/common/gui')
| -rw-r--r-- | src/main/java/gregtech/common/gui/GT_Container_OutputHatch.java | 6 | ||||
| -rw-r--r-- | src/main/java/gregtech/common/gui/GT_GUIContainer_OutputHatch.java | 40 |
2 files changed, 8 insertions, 38 deletions
diff --git a/src/main/java/gregtech/common/gui/GT_Container_OutputHatch.java b/src/main/java/gregtech/common/gui/GT_Container_OutputHatch.java index 954b8ab61b..135c20dafe 100644 --- a/src/main/java/gregtech/common/gui/GT_Container_OutputHatch.java +++ b/src/main/java/gregtech/common/gui/GT_Container_OutputHatch.java @@ -37,15 +37,15 @@ public class GT_Container_OutputHatch extends GT_Container_BasicTank { || (tMode >= 8 && tReadyLockFluid.getFluid().getName().equals(tHatch.getLockedFluidName()))) { tHatch.setLockedFluidName(null); GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("300", "Fluid Lock Cleared.")); - tHatch.mMode = 0; + tHatch.lockFluid(false); } else { tHatch.setLockedFluidName(tReadyLockFluid.getFluid().getName()); GT_Utility.sendChatToPlayer( aPlayer, String.format( - GT_Utility.trans("151.4", "Sucessfully locked Fluid to %s"), + GT_Utility.trans("151.4", "Successfully locked Fluid to %s"), tReadyLockFluid.getLocalizedName())); - tHatch.mMode = 9; + tHatch.lockFluid(true); } } return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); diff --git a/src/main/java/gregtech/common/gui/GT_GUIContainer_OutputHatch.java b/src/main/java/gregtech/common/gui/GT_GUIContainer_OutputHatch.java index 605fb5a463..7e27a7409a 100644 --- a/src/main/java/gregtech/common/gui/GT_GUIContainer_OutputHatch.java +++ b/src/main/java/gregtech/common/gui/GT_GUIContainer_OutputHatch.java @@ -2,25 +2,19 @@ package gregtech.common.gui; import static gregtech.api.enums.GT_Values.RES_PATH_GUI; -import codechicken.nei.VisiblityData; -import codechicken.nei.api.INEIGuiHandler; -import codechicken.nei.api.TaggedInventoryArea; -import cpw.mods.fml.common.Optional; import gregtech.api.enums.GT_Values; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +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 java.util.Collections; -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; -@Optional.Interface(modid = "NotEnoughItems", iface = "codechicken.nei.api.INEIGuiHandler") -public class GT_GUIContainer_OutputHatch extends GT_GUIContainerMetaTile_Machine implements INEIGuiHandler { +public class GT_GUIContainer_OutputHatch extends GT_GUIContainerMetaTile_Machine implements IDragAndDropSupport { private final String mName; private final int textColor = this.getTextColorOrDefault("text", 0xFAFAFF), @@ -62,31 +56,12 @@ public class GT_GUIContainer_OutputHatch extends GT_GUIContainerMetaTile_Machine } @Override - @Optional.Method(modid = "NotEnoughItems") - public VisiblityData modifyVisiblity(GuiContainer gui, VisiblityData currentVisibility) { - return currentVisibility; - } - - @Override - public Iterable<Integer> getItemSpawnSlots(GuiContainer gui, ItemStack item) { - return Collections.emptyList(); - } - - @Override - public List<TaggedInventoryArea> getInventoryAreas(GuiContainer gui) { - return null; - } - - @Override - public boolean handleDragNDrop(GuiContainer gui, int mousex, int mousey, ItemStack draggedStack, int button) { + public boolean handleDragAndDropGT( + GuiContainer gui, int mousex, int mousey, ItemStack draggedStack, int button, boolean isGhost) { if (gui instanceof GT_GUIContainer_OutputHatch && ((GT_GUIContainer_OutputHatch) gui).isMouseOverSlot(3, mousex, mousey)) { // the instanceof check should be unnecessary, but we will do it regardless, just in case. - FluidStack tFluidStack; - tFluidStack = GT_Utility.getFluidForFilledItem(draggedStack, true); - if (tFluidStack == null) { - tFluidStack = GT_Utility.getFluidFromDisplayStack(draggedStack); - } + FluidStack tFluidStack = GT_Utility.getFluidFromContainerOrFluidDisplay(draggedStack); if (tFluidStack != null) { GT_Values.NW.sendToServer(new GT_Packet_SetLockedFluid( ((GT_GUIContainer_OutputHatch) gui).mContainer.mTileEntity, tFluidStack)); @@ -96,9 +71,4 @@ public class GT_GUIContainer_OutputHatch extends GT_GUIContainerMetaTile_Machine } return false; } - - @Override - public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) { - return false; - } } |
