From 06ed79a519c80e85923de122d40659459847648f Mon Sep 17 00:00:00 2001 From: hiroscho Date: Thu, 7 Nov 2024 19:04:14 +0100 Subject: [PATCH] Fix that the clicked slot is not determined correctly --- .../github/client/gui/GuiLevelMaintainer.java | 18 ++++++++++-------- src/main/resources/META-INF/ae2fc_at.cfg | 2 ++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/glodblock/github/client/gui/GuiLevelMaintainer.java b/src/main/java/com/glodblock/github/client/gui/GuiLevelMaintainer.java index 9e12575fe..db0c3ab50 100644 --- a/src/main/java/com/glodblock/github/client/gui/GuiLevelMaintainer.java +++ b/src/main/java/com/glodblock/github/client/gui/GuiLevelMaintainer.java @@ -2,7 +2,6 @@ import static com.glodblock.github.client.gui.container.ContainerLevelMaintainer.createLevelValues; -import java.awt.Rectangle; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -354,18 +353,21 @@ public List getInventoryAreas(GuiContainer gui) { return null; } - private Rectangle getSlotArea(SlotFake slot) { - return new Rectangle(guiLeft + slot.getX(), guiTop + slot.getY(), 16, 16); - } - @Override public boolean handleDragNDrop(GuiContainer gui, int mouseX, int mouseY, ItemStack draggedStack, int button) { - if (draggedStack != null) { - draggedStack.stackSize = 0; + if (draggedStack == null) { + return false; } + + draggedStack.stackSize = 0; + Slot slotAtPosition = this.getSlotAtPosition(mouseX, mouseY); + if (slotAtPosition == null) { + return false; + } + for (int i = 0; i < this.cont.getRequestSlots().length; i++) { SlotFluidConvertingFake slot = this.cont.getRequestSlots()[i]; - if (getSlotArea(slot).contains(mouseX, mouseY) && draggedStack != null) { + if (slotAtPosition.equals(slot)) { ItemStack itemStack = createLevelValues(draggedStack.copy()); itemStack.getTagCompound().setInteger(TLMTags.Index.tagName, i); slot.putStack(itemStack); diff --git a/src/main/resources/META-INF/ae2fc_at.cfg b/src/main/resources/META-INF/ae2fc_at.cfg index 43816380a..cd2223758 100644 --- a/src/main/resources/META-INF/ae2fc_at.cfg +++ b/src/main/resources/META-INF/ae2fc_at.cfg @@ -7,3 +7,5 @@ public net.minecraft.client.gui.inventory.GuiContainer field_147009_r # guiTop public net.minecraft.client.gui.inventory.GuiContainer field_147006_u #theSlot public net.minecraft.client.renderer.texture.TextureMap field_110574_e # mapRegisteredSprites + +protected net.minecraft.client.gui.inventory.GuiContainer func_146975_c(II)Lnet.minecraft.inventory.Slot; # getSlotAtPosition