Are you sure you want to report this?

We've split up the commands, scripting and mods, and add ons category! Please be sure you get your thread in the right place.


Changes to /replaceitem


Post a new comment:

Please sign in to leave a comment.

Sorted by oldest
  • 0
    mestesso123 commented
    Comment actions Permalink

    I agree with what you say in this post, but you should remove the option to select items from storages, as they're just a storage of NBT data and they have no slots

  • 0
    Austin Barton commented
    Comment actions Permalink

    THIS IS THE NOTE FROM ABOVE! (Read the article if you don't have context)

    I know storages don't have slots, so one of two things can happen:

    You could simply remove the option (like in the post above) or

    You could add a new NBT tag specific to storages -- {StorageItems:[{}]}. The "format" would be the exact same as blocks and entities. This would act as the "slots" in storage. If this is not possible, then the first option is fine.


    mestesso123, thank you for the comment, I thought I addressed that in the article but apparently not. 

  • 0
    Comment actions Permalink

    This is already possible with the /data modify command, but it takes three commands to work, possibly four. I'll take your second example for this one, note that storage is for NBT, not a container:

    First, you need to make sure that an item already exists in the area that you want to modify, and add a temporary item there if it doesn't:

    execute unless data block 0 0 0 Items[{Slot:0b}] run data merge block 0 0 0 {Items:[{Slot:0b, id:"minecraft:dirt",Count:1b}]}

    Then you have to change the tags id, Slot, and the tag compound with one command each:

    data modify block 0 0 0 Items[{Slot:0b}].id set from entity @e[type=armor_stand,limit=1,sort=nearest] ArmorItems[3].id
    data modify block 0 0 0 Items[{Slot:0b}].Count set from entity @e[type=armor_stand,limit=1,sort=nearest] ArmorItems[3].Count
    data modify block 0 0 0 Items[{Slot:0b}].tag set from entity @e[type=armor_stand,limit=1,sort=nearest] ArmorItems[3].tag

    And that's how to modify one slot at a time! Considering that we have functions in Minecraft Java Edition, there isn't a need for a shortcut for this.


    That's been added to Minecraft Java Edition, and the command has been moved to /item instead.

    item entity @s weapon.offhand copy entity @s weapon.mainhand