Closed DavideTW closed 8 months ago
Could you provide a video of the issue?
Sure, here's a video.
https://github.com/WesJD/AnvilGUI/assets/64831836/e90989b1-77e2-4993-8364-c3442011c348
@WesJD same problem
Tested in 1.19, same problem.
Tested with AnvilGui 1.8.0, same problem.
Tested with Player#closeInventory,
same problem.
Tested with return List.of(AnvilGUI.ResponseAction.close())
, same problem
Sorry, I really want to take a look at this but I'm swamped with life right now. I won't be able to take a look for a least another week or two.
Could someone give this a look if they have time? Calling in our awesome contributors like @mastercake10 and @Phoenix616, or anyone who can.
Turns out when you click outside the GUI with an item, it still triggers the clickHandler, which should not happen. In this case, the rawSlot
id is -999, which is invalid. Will submit a PR.
ok, drop outside inv fixed. Same problem if I click with an item on the left or right item.
@mastercake10 heres a video
https://github.com/WesJD/AnvilGUI/assets/64831836/fb26dbef-c28e-4c6c-bb50-abe347fc405a
Problems with new commit (idk if you have finished working on it @mastercake10):
Can't drop items with an anvilgui opened anymore https://github.com/WesJD/AnvilGUI/assets/64831836/27e380cd-7e99-4dc2-a634-644d88c1ec99
Can't move item in the player inventory anymore (only drag is working) https://github.com/WesJD/AnvilGUI/assets/64831836/e138889e-b77d-4ae8-ba7c-4d92c898316e
I've found another bug (working with last master commit and last dev commit): If I open an anvilgui with an item on the cursor I lose the item. If you are wondering how I'm opening a anvilgui with an item on the cursor I've made an item in a gui (normal bukkit gui) that opens an anvil gui.
Notice that if I click on an item that open a normal gui the item it is not lost.
https://github.com/WesJD/AnvilGUI/assets/64831836/1891ab10-6d39-44ac-9116-ae3f1bfd680d
@DavideTW I think I've fixed all the bugs you mentioned.
I've found another bug (working with last master commit and last dev commit): If I open an anvilgui with an item on the cursor I lose the item. If you are wondering how I'm opening a anvilgui with an item on the cursor I've made an item in a gui (normal bukkit gui) that opens an anvil gui.
Working with your code example, I found out that vanilla calls an extra method for properly closing the previous container and putting back the cursor item into the player's inventory, EntityPlayer#doCloseContainer
. Somehow this call was never added to AnvilGUI, so I've added this method for all version wrappers in my PR.
https://github.com/WesJD/AnvilGUI/assets/16278273/5176bc2d-cbb2-4026-a745-faf646b1fe49
AnvilGui version: 1.9.0-SNAPSHOT Paper version: 1.20.1
Basically, if I have an AnvilGui opened and I try to drop an item or click with an item in the text area, the gui closes and the item disappear.
My code: