I coulnd’t find any good help inside the documentation and inside the forum. Because of that I decided to create this topic to ask the following questions I am struggeling with.
1.) How do I add an item to a specific slot into the players inventory?
All topics I found were outdated with depricated examples that doesn’t work for me
Example: How to Place Item in an Inventory Solution: Get the players main Inventory to access the grid Inventory. Inside the grid Inventory you can use the set method to specify the slot number or slot position.
2.) How can I get the clicked slot index inside the ClickInventoryEvent event?
Found a topic for this aswell, but based on the topic it wasn’t implemented years ago. I also tested it with the 7.1.0 API but the results are still empty.
Source: Howto get clicked slot position in the inventory
3.) How do I get the clicked item and the item on the cursor?
So a lot of the inventory api has changed over the years. For part 2, what event are you using?
As for part 1, your solution is correct. You can use Query as shown in your solutions post. To gain the slot, from there use Slot.set(item) to set the item in that slot
I am currently using the ClickInventoryEvent.Primary event, but I don’t know how to get the related/clicked slot number. As mentioned above the slot index and slot position properties are empty.