Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Swap offhand item does not work in inventory screen #6917

Closed
sciwhiz12 opened this issue Jul 4, 2020 · 1 comment
Closed

Swap offhand item does not work in inventory screen #6917

sciwhiz12 opened this issue Jul 4, 2020 · 1 comment

Comments

@sciwhiz12
Copy link
Contributor

Minecraft Version: 1.16.1

Forge Version: 32.0.47

Logs: not applicable, ingame behavior issue

Steps to Reproduce:

  1. Put an item in the offhand slot
  2. Press F (the keybind for Swap Item with Offhand) on an empty slot in the player's inventory
  3. Observe that no action occurs
  4. Press F on a slot with items in the player's inventory
  5. Observe that no action occurs
  6. Remove the item from the offhand slot
  7. Press F on a slot with items in the player's inventory
  8. Observe that no action occurs

Description of issue:
Minecraft 1.16 added the ability to switch items to and from the offhand slot within an inventory by pressing F (or the key bound to Swap Item with Offhand) on an inventory or armor slot. However, on the tested version of Forge, no switching occurs.

I have tested on Vanilla 1.16.1 that the given steps do activate the aforementioned ability in the survival, creative, adventure player inventories, and the chest and hopper inventories.
I have tested on the given Forge 1.16.1 version that the given steps do not activate the aforementioned ability in the survival, creative, adventure player inventories, and the chest and hopper inventories.

Original bug report from the Forge Support Forum.

@sciwhiz12 sciwhiz12 added the Triage This request requires the active attention of the Triage Team. Requires labelling or reviews. label Jul 4, 2020
@sciwhiz12
Copy link
Contributor Author

sciwhiz12 commented Jul 5, 2020

I have found the cause of the issue: the Swap Item with Offhand keybind has the IN_GAME set as its IKeyConflictContext, which makes the key only work when the player is not in a GUI. The method responsible for setting the keybind's conflict context is GameSettings#setForgeKeybindProperties, which is called automatically by the constructor.

I have tested a fix by using debugging tools and manually setting the conflict context back to UNIVERSAL, and the switching action works. A fix for this is simple: removing the line that sets the conflict context of the keybind in question. (I'm trying to make a fix PR, but extractRangeMap still hates me)

@LexManos LexManos closed this as completed Jul 6, 2020
@autoforge autoforge bot removed the Triage This request requires the active attention of the Triage Team. Requires labelling or reviews. label Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants