I am trying to make a mailbox system and want to have the items in a chest teleported to another chest where I can pickup my 'mail'.
Minecraft – How to move items from one chest to another using commands
minecraft-commandsminecraft-java-edition
minecraft-commandsminecraft-java-edition
I am trying to make a mailbox system and want to have the items in a chest teleported to another chest where I can pickup my 'mail'.
Best Answer
The
/clone
command can copy the chest and place it elsewhere:For example, if the chest you're inserting items to is at X0, Y64, Z0, and the mailbox chest is at X100, Y64, Z100:
Keep in mind that this requires both coordinate locations to be loaded. You can use the
/spreadplayers
command to forcibly load the chunks using a dummy entity such as an armor stand just before running the /clone command.And one other thing to note is that the contents of the mailbox will be completely replaced, so any items that were still in that chest will be deleted. A solution to that is to clone the initial chest above a hopper above the mailbox chest, such that the items will be transferred to the mailbox.
You could also use
/setblock
to destroy the cloned chest such that the items will be dropped instantly and do not have the risk of being deleted as well.