0

Im trying to clone the inventory of one named storage to another. I first tried finding a way to clone the inventory of a chest.

e.g:

execute as @e run data modify block[type=chest,name=input]...

But that didn't work because i couldn't because the block syntax only accepts xyz coordinates and not nbt data.

So i tried to do it with a chest Minecart using the data modify command which allow me to find my item through nbt selectors.

execute as @e run data modify entity @s[type=minecraft:chest_minecart,name=output] Items set from entity @s[type=minecraft:chest_minecart,name=input] Inventory

However for one reason or another I get no response at all. Did I write this right or is there another way to do this.

2
  • I ran the following as a datapack and nothing happened I still didn't get the items clone in the first chest however I got output in chat of "[input] 1234" execute as @e run data modify entity @s[type=minecraft:chest_minecart,name="output"] Items set from entity @s[type=minecraft:chest_minecart,name="input"] Items execute as @e if entity @s[name="input"] run say 1234
    – Oakrest
    Commented May 9, 2021 at 18:36
  • Yes, one called input another called output
    – Oakrest
    Commented May 9, 2021 at 18:54

1 Answer 1

0

What your original command does in Plain English:

Tell all entities to, if they are a chest minecart named output, modify their Items tag to itself, only if they are also named Input.

That doesn't make sense. An entity can't be named both input and output at the same time. And, because you're using @s for both selectors in the /data command, the chest minecarts would be referring to themselves only to set the data, not any of the other chest minecarts.

So to fix this, try this approach:

execute as @e[type=chest_minecart,name=output] run data modify entity @s Items set from entity @e[type=chest_minecart,name=input,limit=1] Items

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .