1

Inventory swap?

web_warrior_geo_1 2/28/24 1:57 pm
243
2/28/2024 3:12 pm
anyone know the easiest/simplest way to swap 2 players' inventories?
Posted by
web_warrior_geo_1
Level 1 : New Miner
1

  Have something to say?

JoinSign in

1

michaelo
02/28/2024 3:12 pm
Level 36 : Artisan Taco Chef
history
One way would be to use the shulker box trick. You copy the inventories to shulker boxes, and then alter the loot table of the shulker boxes to drop their contents when mined, which means you can use the loot command to give a player the loot from them (downside is it won't keep the right slots). It's a bit complicated, here's a better explanation/tutorial:
https://www.reddit.com/r/MinecraftCommands/wiki/questions/modifyinventory/

Alternatively you could copy the players' inventories to storage, and then iterate through the inventory lists to give each item using the /item command and macros.

Unfortunately all methods are a bit tricky, if you're unsure I'd recommend getting some closer help from someone, for example from the Minecraft Commands discord or Datapack Hub.
3

Welcome