Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Added option to right click in chests #24

Open
wants to merge 1 commit into
base: 1.16
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/net/kyrptonaught/quickshulker/api/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/assets/quickshulker/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}