diff options
author | Glease <4586901+Glease@users.noreply.github.com> | 2022-01-04 01:19:56 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-03 18:19:56 +0100 |
commit | 5cf9aa8a9033d19ea7dd2b8739384c08006f4da2 (patch) | |
tree | 369f3d482f200e7fdcee1df9eb62f4365d6be0e7 /src/main/java/gregtech/api/gui | |
parent | ce70eef5b55ee411800606f621af8bafd7eff70e (diff) | |
download | GT5-Unofficial-5cf9aa8a9033d19ea7dd2b8739384c08006f4da2.tar.gz GT5-Unofficial-5cf9aa8a9033d19ea7dd2b8739384c08006f4da2.tar.bz2 GT5-Unofficial-5cf9aa8a9033d19ea7dd2b8739384c08006f4da2.zip |
Allow drag and drop from NEI to set output hatch locking (#845)
* Allow drag and drop from NEI to set output hatch locking
also cleaned up the output hatch networking code
* Add not locked indicator
Diffstat (limited to 'src/main/java/gregtech/api/gui')
-rw-r--r-- | src/main/java/gregtech/api/gui/GT_GUIContainer.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer.java b/src/main/java/gregtech/api/gui/GT_GUIContainer.java index b122b33a73..af6c37a8dd 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer.java @@ -3,9 +3,12 @@ package gregtech.api.gui; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; import net.minecraft.util.ResourceLocation; import org.lwjgl.input.Mouse; +import static gregtech.GT_Mod.GT_FML_LOGGER; + /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> @@ -69,6 +72,18 @@ public class GT_GUIContainer extends GuiContainer { protected void onMouseWheel(int mx, int my, int delta) { } + public boolean isMouseOverSlot(int slotIndex, int mx, int my) + { + int size = inventorySlots.inventorySlots.size(); + if (slotIndex < 0 || slotIndex >= size) { + // slot does not exist somehow. log and carry on + GT_FML_LOGGER.error("Slot {} required where only {} is present", slotIndex, size); + return false; + } + Slot slot = inventorySlots.getSlot(slotIndex); + return this.func_146978_c(slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, mx, my); + } + /* @Override protected void drawSlotInventory(Slot par1Slot) { |