diff options
Diffstat (limited to 'src/main/java/io')
3 files changed, 17 insertions, 1 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java index 256cf03f..cd128ebe 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java @@ -79,6 +79,14 @@ public class SlotLocking { private boolean lockKeyHeld = false; private Slot pairingSlot = null; + private Slot realSlot = null; + + public void setRealSlot(Slot slot){ + realSlot = slot; + } + + public Slot getRealSlot(){ return realSlot;} + public void loadConfig(File file) { try(BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))) { config = GSON.fromJson(reader, SlotLockingConfig.class); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java index e527e18e..3ed16e76 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java @@ -101,7 +101,10 @@ public abstract class MixinGuiContainer extends GuiScreen { @Inject(method="drawScreen", at=@At("RETURN")) public void drawScreen(CallbackInfo ci) { if(theSlot != null && SlotLocking.getInstance().isSlotLocked(theSlot)) { + SlotLocking.getInstance().setRealSlot(theSlot); theSlot = null; + } else if( theSlot == null){ + SlotLocking.getInstance().setRealSlot(null); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java index a4af51ca..5ca9b316 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -8,6 +8,7 @@ import com.mojang.authlib.Agent; import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking; import io.github.moulberry.notenoughupdates.util.TexLoc; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; @@ -433,7 +434,11 @@ public class Utils { } public static Slot getSlotUnderMouse(GuiContainer container) { - return (Slot) getField(GuiContainer.class, container, "theSlot", "field_147006_u"); + Slot slot = (Slot) getField(GuiContainer.class, container, "theSlot", "field_147006_u"); + if(slot == null){ + slot = SlotLocking.getInstance().getRealSlot(); + } + return slot; } public static void drawTexturedRect(float x, float y, float width, float height) { |