Open arthurvanl opened 1 month ago
shift click does not work
This is either a bug or a missing feature depending on ones perspective, but either way I agree that it should be possible to allow shift-clicks. The reason it does not currently work is that AnvilGUI can't tell what will happen when you shift-click (unless AnvilGUI reimplements the entire vanilla inventory logic, which is not going to happen), so AnvilGUI doesn't know which slot(s) the shift-clicked item stack will end up in. Because of that, AnvilGUI can't tell whether the shift-click should be allowed or not based on the interactableSlots
, so currently it just denies the shift-click. In my opinion, interactableSlots
was kind of a mistake because as you can see it's kind of impossible to implement "correctly".
But either way, I think we can make a band-aid fix in AnvilGUI by allowing shift-clicks only if both the left and the right input slot is interactable, because then AnvilGUI does not need to know where the items would end up. And if for some reason someone wants only one of the input slots to be interactable, they can just reimplement the inventory logic themselves.
I'll add this fix after updating AnvilGUI to work on Minecraft 1.21.3.
item gets lost on close
For historical reasons, that's kind of how AnvilGUI works (AnvilGUI was created as a text input library, not a general-purpose Anvil library), but I can see why you're confused (I'll try to improve the documentation later). You can implement the item drop logic yourself via onClose
, see https://github.com/WesJD/AnvilGUI/issues/354#issuecomment-2412058707
AnvilGUI always sets the final level cost to 0. I think we should make this more customizable, but I guess this wasn't done because most people's use cases for AnvilGUI involved using it as text input or some kind of custom anvil where they didn't want to consume XP from the player.
I see this in your comment. Can this be changed? I really would like to use this and the shift click. The main reason why I stopped using anvils at the moment. Much appreciated!
https://github.com/user-attachments/assets/fd54e8c2-053c-43b2-838d-824d30bfa9cd
I am using 1.10.2-SNAPSHOT and item gets lost on close and shift clicking does not work.
code I used: