Finding a player with a certain item and giving them another item [duplicate]

Finding a player with a certain item and giving them another item [duplicate] - Free stock photo of antique, architecture, candle

I'm working on a current map and this is the only hitch I'm at so far. I know that I can do a testfor command with a command block to see if anyone is holding a specific item, but I also want to give the person that has that item on them, a new item. For example, if someone has a diamond on them, I want to be able to, through command blocks, find that person and give them a blaze rod. Appreciate all help!






Pictures about "Finding a player with a certain item and giving them another item [duplicate]"

Finding a player with a certain item and giving them another item [duplicate] - Young woman watching movie in headphones in messy room
Finding a player with a certain item and giving them another item [duplicate] - Leather Samples on the Table for Selection
Finding a player with a certain item and giving them another item [duplicate] - Unpacked boxes in middle of room



How do you Testfor a player holding an item?

Open the inventory. Click on the item you want to duplicate to pick it up. Hold your mouse's scroll wheel button and drag it over empty inventory slots to duplicate it as stacks in your inventory.

How do you duplicate items in Minecraft with commands?

Item data tags
  • Naming items. To give a named item to someone, use /give @p minecraft:stone 1 2 {display:{Name:"NAMED ITEM"}} . ...
  • Checking for items. To check if a player has an item, use the player data tag {Inventory:[{Slot:1234b,id:"minecraft:redstone"}]} ...
  • Enchanting items. To enchant an item, there's a special data tag.




  • How i Got 999 Nether Star in Skyblock Very Rare Items Duplicate Skyblock BlockmanGo




    Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

    Images: Karolina Grabowska, Andrea Piacquadio, cottonbro, Ketut Subiyanto