Sorting broken in Anvil GUI
tomdaly opened this issue ยท 6 comments
When changing an item's name in an anvil, if it includes a letter which is also your sorting key (mine is R), then it sorts.
Eg. changing the name of a diamond sword to "Big Sword" would sort the inventory when getting to R, and is quite annoying.
Thank you Kobata.
There are a whole bunch of issues with that keybind and various GUIs (It doesn't get along well with NEI for instance).
I'm really not sure what I can do about it in general other than refusing to detect presses of it while a GUI is open.
Looking specifically at the anvil (GUIRepair), I would need to use reflection (or some other method of making the field public) to get at it's reference to the text box because there is no way outside of that class to know it exists, much less to tell if it's focused.
Is making the field public with reflection in an anvil wrapper class doable? It may be better for that to be in Forge itself, though . . .
Oh, I can get to the field easily enough, there's just a bunch of GUIs where you can type and the key detection in Inventory Tweaks will probably pick it up -- I wouldn't be surprised if it triggered in the book writing interface. I know it triggers in creative search and the NEI search box. They'd all have to be handled specifically because Minecraft doesn't have a generic way to see if something is using the keyboard for text-input.
I can see about adding an option to just disable it in everything but the main ingame screen, since all the container/inventory screens you can middle-click for. (And maybe add the z-for-sort button from chests to the main inventory as well)
Just a note that I might want to look into this with the coremod change, since I can use that to insert some code to disable/re-enable the sort key in the (vanilla) GUIs that have issues.
Mods (such as NEI) are going to have to either rely on the API method to do that or someone else writing a compatibility plugin that calls the API method.
Fixed by 0417162 (build 26)
Anything using the default MC GuiTextField should now force the sorting shortcut off while the text field is focused.