diff --git a/src/main/java/net/kyrptonaught/quickshulker/api/Util.java b/src/main/java/net/kyrptonaught/quickshulker/api/Util.java index c590ec9..2a54c1b 100644 --- a/src/main/java/net/kyrptonaught/quickshulker/api/Util.java +++ b/src/main/java/net/kyrptonaught/quickshulker/api/Util.java @@ -75,7 +75,7 @@ public void onPropertyUpdate(ScreenHandler handler, int property, int value) { } public void isValid() { - if (!player.inventory.contains(stack)) { + if (!player.inventory.contains(stack) && !QuickShulkerMod.getConfig().rightClickInChest) { ((ServerPlayerEntity) player).networkHandler.sendPacket(new CloseScreenS2CPacket(player.currentScreenHandler.syncId)); player.currentScreenHandler = player.playerScreenHandler; } diff --git a/src/main/java/net/kyrptonaught/quickshulker/config/ConfigOptions.java b/src/main/java/net/kyrptonaught/quickshulker/config/ConfigOptions.java index 6888604..de54422 100644 --- a/src/main/java/net/kyrptonaught/quickshulker/config/ConfigOptions.java +++ b/src/main/java/net/kyrptonaught/quickshulker/config/ConfigOptions.java @@ -14,4 +14,6 @@ public class ConfigOptions implements AbstractConfigFile { public boolean keybingInInv = true; @Comment("Right Clicking a shulker in your inv opens it") public boolean rightClickInv = true; + @Comment("Right Clicking a shulker in a chest opens it (requires rightClickInv)") + public boolean rightClickInChest = false; } diff --git a/src/main/java/net/kyrptonaught/quickshulker/config/modmenu/ModMenuIntegration.java b/src/main/java/net/kyrptonaught/quickshulker/config/modmenu/ModMenuIntegration.java index 99687cc..464bc62 100644 --- a/src/main/java/net/kyrptonaught/quickshulker/config/modmenu/ModMenuIntegration.java +++ b/src/main/java/net/kyrptonaught/quickshulker/config/modmenu/ModMenuIntegration.java @@ -40,6 +40,7 @@ public String getModId() { category.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("key.quickshulker.config.rightClick"), options.rightClickToOpen).setSaveConsumer(val -> options.rightClickToOpen = val).setDefaultValue(true).build()); category.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("key.quickshulker.config.keybindInInv"), options.keybingInInv).setSaveConsumer(val -> options.keybingInInv = val).setDefaultValue(true).build()); category.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("key.quickshulker.config.rightClickInInv"), options.rightClickInv).setSaveConsumer(val -> options.rightClickInv = val).setDefaultValue(true).build()); + category.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("key.quickshulker.config.rightClickInChest"), options.rightClickInChest).setSaveConsumer(val -> options.rightClickInChest = val).setDefaultValue(false).build()); return builder.build(); }; diff --git a/src/main/java/net/kyrptonaught/quickshulker/mixin/ScreenMixin.java b/src/main/java/net/kyrptonaught/quickshulker/mixin/ScreenMixin.java index 55f189e..c95d4a6 100644 --- a/src/main/java/net/kyrptonaught/quickshulker/mixin/ScreenMixin.java +++ b/src/main/java/net/kyrptonaught/quickshulker/mixin/ScreenMixin.java @@ -9,6 +9,7 @@ import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.client.util.InputUtil; import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.inventory.SimpleInventory; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.screen.ScreenHandler; @@ -90,7 +91,7 @@ private boolean handleTrigger() { @Unique private boolean isValid(ItemStack stack, int id, int type) { - if (this.focusedSlot.inventory instanceof PlayerInventory) + if (this.focusedSlot.inventory instanceof PlayerInventory || (QuickShulkerMod.getConfig().rightClickInChest && this.focusedSlot.inventory instanceof SimpleInventory)) if (ClientUtil.CheckAndSend(stack, id, type)) { QuickShulkerMod.lastMouseX = MinecraftClient.getInstance().mouse.getX(); QuickShulkerMod.lastMouseY = MinecraftClient.getInstance().mouse.getY(); diff --git a/src/main/resources/assets/quickshulker/lang/en_us.json b/src/main/resources/assets/quickshulker/lang/en_us.json index caed3b8..cc35c21 100644 --- a/src/main/resources/assets/quickshulker/lang/en_us.json +++ b/src/main/resources/assets/quickshulker/lang/en_us.json @@ -6,5 +6,6 @@ "key.quickshulker.config.keybind": "Keybinding while holding item", "key.quickshulker.config.rightClick": "Right Click while holding item", "key.quickshulker.config.keybindInInv": "Keybind while hovering in Inventory", - "key.quickshulker.config.rightClickInInv": "Right click while hovering in Inventory" + "key.quickshulker.config.rightClickInInv": "Right click while hovering in Inventory", + "key.quickshulker.config.rightClickInChest": "Right click while hovering in Chest" } \ No newline at end of file