Fabric API

Fabric API

108M Downloads

KeyBindingHelper removes conflicting vanilla keybinds

Stuff-Stuffs opened this issue ยท 2 comments

commented

If a modded key uses the same keycode as a vanilla keybinding, the vanilla keybinding is removed. This happens because of line 80 in KeyBindingRegistryImpl, which tries to remove previous modded keybinds before readding them. However KeyBinding has equals() overridden, it is true whenever the boundKey is equivalent, this happens whenever the InputUtil.Type and keycode are the same. This means that any vanilla KeyBinding disappears if a modded keybinding has the same code and type.

commented

I think the fix is to find and remove the duplicates based on their reference equality rather than their normal equality, which just compares bound keys.

commented

This only seems to be a bug in 1.17 as in 1.16.5 mojang do not override KeyBinding.equals()