Give Player a Custom Inventory

Quick question: how do I give a player a Custom Inventory. I know I can build one like so:

CustomInventory inventory = Inventories.customInventoryBuilder()

But how do I give that to a player?


I don’t think the inventory API is implemented yet (it will throw an exception and/or error).

1 Like

That’s how I make a player view an inventory. Maybe the CustomInventory was a bad example, but I want to set the player’s actual inventory to something else.

In short, I’m trying to make a snapshot of the player’s Inventory, so I can set it to the side and restore it later.

What you need is not directly available in the API, but I think it’s still possible.
You need to iterate over the inventory, it’s children and each itemstack. Store the data in some structure.
Then at a later date you rebuild the inventory from the structure.