I personally have not dabbled in the Inventory API as much as the rest of what Sponge has to offer, but I am starting to. However I have a question.
In the Anvil inventory architecture. A player can type anything into the tiny box before setting that tiny box as the items name.
From
Inventory inv;
How would one get that text (guessing it has something to do with StringProperty) and also is there a event that is triggered when a player types a new character into the string?
It’s just all assumption so don’t expect them to work
First, I would query the appropriate Inventory for the anvil. My best shot would be CraftingInventory, but there are more Inventories here. The thing is, you have to acquire the inventory group via query.
Plus, I believe the input part (character by character) is client side. So unless you have some custom mods for it, you only get the final input String only
That wouldn’t make sense, because the server needs to update the result item.
Minecraft uses a plugin message for this action. The channel is MC|ItemName, and the payload is a string with the name the player has typed in. This packet is sent for each modification of the text field, letter by letter.