diff options
author | DoKM <mcazzyman@gmail.com> | 2021-08-21 11:44:30 +0200 |
---|---|---|
committer | DoKM <mcazzyman@gmail.com> | 2021-08-21 11:44:30 +0200 |
commit | fefed35f9af4e2abdedf9d1788d83662171089c8 (patch) | |
tree | bd867feef3f7ca5e39aa9dd12b4bd8abc32cd7d6 /src/main/java | |
parent | 9bdf107725ec331d0acb24a53ad3708547bfdb06 (diff) | |
download | NotEnoughUpdates-fefed35f9af4e2abdedf9d1788d83662171089c8.tar.gz NotEnoughUpdates-fefed35f9af4e2abdedf9d1788d83662171089c8.tar.bz2 NotEnoughUpdates-fefed35f9af4e2abdedf9d1788d83662171089c8.zip |
Fix being able to hotkey slotlocked items in a container
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java | 8 |
1 files changed, 7 insertions, 1 deletions
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 3ed16e76..82634c87 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java @@ -30,6 +30,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; @@ -166,6 +167,12 @@ public abstract class MixinGuiContainer extends GuiScreen { } return slot.canBeHovered(); } + @Inject(method="checkHotbarKeys", at=@At(value = "INVOKE", target = "Lnet/minecraft/client/gui/inventory/GuiContainer;handleMouseClick(Lnet/minecraft/inventory/Slot;III)V"), locals = LocalCapture.CAPTURE_FAILSOFT ,cancellable = true) + public void checkHotbarKeys_Slotlock(int keyCode, CallbackInfoReturnable<Boolean> cir, int i){ + if(SlotLocking.getInstance().isSlotIndexLocked(i)){ + cir.setReturnValue(false); + } + } @Inject(method="handleMouseClick", at=@At(value="HEAD"), cancellable = true) public void handleMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType, CallbackInfo ci) { @@ -209,5 +216,4 @@ public abstract class MixinGuiContainer extends GuiScreen { } } } - } |