Packed Inventory

Packed Inventory

430k Downloads

[Feature Request] right click to open inventories

supersaiyansubtlety opened this issue ยท 4 comments

commented

It would be great to, instead of using a keybind, use right click to open shulkers/ender chests/etc.

This would work either while holding the inventory item or while your cursor hovered the item in your inventory.

commented

I don't really like the RMB idea, because the right mouse button is already assigned to another action in the terms of player inventory (i.e., take a half of the selected item stack), so it definitely won't be implemented as a default option. But I can fix this method:

public static boolean isKeyBindingPressed(KeyBinding binding) {
net.minecraft.client.util.InputUtil.Key boundKey = KeyBindingHelper.getBoundKeyOf(binding);
if (binding.isUnbound() || boundKey.getCategory() != net.minecraft.client.util.InputUtil.Type.KEYSYM) {
return false;
}
Window window = MinecraftClient.getInstance().getWindow();
if (window == null) {
return false;
}
return net.minecraft.client.util.InputUtil.isKeyPressed(window.getHandle(), boundKey.getCode());
}

I don't remember why I made this special case, but if I ensure that this method works for mouse keys, you will be able to bind something like MMB (or even RMB, but I don't know why) as well

commented

Ok, sounds good!

commented

Hm. I'm currently poking this idea around and I'm becoming more and more convinced that it is not that great. A non-exhaustive list of problems with mouse key binds I've stumbled upon while testing them:

  • LMB and RMB are obviously super-conflicty, as I said before. They kinda work only when you use them from your hotbar, because when you try to use them from your inventory, an inventory item is removed from the selected slot before the edit request even has a chance to be read by a server
  • MMB is significantly better, but it is till far from perfect. It's assigned to too many actions in vanilla (sometines this key is just harcoded into the Minecraft code):
    • Every time you try to open an inventory view in the Creative mode from your inventory via MMB, the hovered stack gets copied
    • Often when you try to open an inventory view in the Creative mode from your hotbar via MMB, the selected stack gets replaced with the target block
    • The same problem applies to survival too, it's just not that bad, because an inventory item is not obliterated like in Creative, it's just swapped with the target block if it was present in your inventory
  • etc.

Too many logical conflicts. I don't think it's worthy to bring something that broken to the game

commented

So, mouse key binds do work now, but I cannot go any further, because there's no good way to deal with all these conflicts, it just doesn't exist. Therefore, conflicts are left to users to decide what to do with them. For example, I can recommend you to re-bind the "Pick item" to something else and bind the MMB to the "Open edit screen" command. I think, I will use this approach myself :)