From 5cf9aa8a9033d19ea7dd2b8739384c08006f4da2 Mon Sep 17 00:00:00 2001 From: Glease <4586901+Glease@users.noreply.github.com> Date: Tue, 4 Jan 2022 01:19:56 +0800 Subject: 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 --- src/main/java/gregtech/api/gui/GT_GUIContainer.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/main/java/gregtech/api/gui') 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!!! *

@@ -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) { -- cgit