I'm trying to place items in certain slots in a players inventory and I know you can testfor an item in a specific slot:

/testfor @a[r=10] {Inventory[{Slot:103b,id:"minecraft:leather_helmet"}]} This is actually a command I used in 1.8

Instead of the testfor to test for the item in a slot, place the item in a slot, using a command like the give command to place the item in the specific slot:

/give @a[r=10] {Inventory:[{Slot:103b,id:"minecraft:leather_helmet"}]}

Can I do this in Minecraft 1.9?

  • Maybe /replaceitem, although I could have sworn that it, like /entitydata didn't work on players.
    – MBraedley
    Apr 8 '16 at 0:53

It is possible, using replaceitem:

/replaceitem entity @a[r=10] slot.armor.head minecraft:leather_helmet 1 0 {}

I’ve tested this, and it seems to work. If you encounter any problems, please comment and I will look into it further. Source: Minecraft Wiki

PS. You can change it to an inventory slot with slot.inventory.(0-26). For other places, see the Minecraft Wiki

  • Awesome, thanks so much, you just solved a part of problem to a problem that I thought was solved. Now it is!
    – Jason_
    Apr 9 '16 at 4:21
  • how would I do this for a normal inventory slot? What tag should I use?
    – Jason_
    Apr 10 '16 at 4:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.