[BUG] Error key binding prompt display
Giant-Salted-Fish opened this issue ยท 2 comments
Minecraft Version
1.16.5
Mod Version
7.1.25
Mod Loader
Forge
What environment are you running the mod in?
Client
Issue Description
Someone has reported a key prompt display issue when using this mod with my Key Binding Patch mod. Original issue is here: Giant-Salted-Fish/Key-Binding-Patch#6.
I have reviewed the code of this mod and the cause is here:
Although it is called KeyBinding#getTranslationKey()
in mcp
mapping, it is actually called KeyBinding#saveString()
in official
mapping. And this method is not suitable to retrieve localized key display name because it only returns the key code of the key binding without the modifiers.
Appropriate method to use here is KeyBinding#func_238171_j_()
, which has corresponding name KeyBinding#getTranslatedKeyMessage()
in official
mapping. It returns a ITextComponent
instance that contains the right localized display string of the binding key. It is also the method that being used in the ControlsScreen
to display the key of the key binding.
Hence replace I18n.format(this.keybind.getTranslationKey())
with this.keybind.func_238171_j_().getString()
should be able to fix this issue.
Thank you for looking into this issue and providing detailed info on what to fix. I've verified the issue has been fixed and have uploaded a new version. It's fixed in 7.1.27