Make a minecart chest act like enderchest
So I want for players to be able to summon a minecart chest that is synonomous with their enderchest. My conceptual plan so far:
- Set the spawned minecart to store the uuid of the player that spawned it
- detect player opening cart with an advancement
- when a player clicks on the minecart check if the uuid matches that stored in the minecart. if yes: open, if no: destroy the minecart
- copy the players enderchest to the minecart
- when the player leaves the minecart menu copy the contents back to their enderchest.
I just can't think how I would detect the player leaving the minecart menu. Any ideas on how to do this? / Is this a good approach in the first place?