I am making an adventure map and am making it so that you craft a piece of tnt that should be placed on an observer. Though, when it is crafted it can't be placed on anything. I have tried several times with different commands but none seem to work.

/replaceitem entity @p [name=tnt]slot.weapon.mainhand 1 tnt 1 0 {"minecraft:can_place_on":{"blocks":["observer"]}}

This is one command i've tried several times. It looks promising but says that "no targets matched selector". Even if the "[name=tnt]" is swapped by "[name=!tnt]" (that should make it so that everything exept tnt changes) the tnt changes.

I would be greatful if anyone could help me.


1 Answer 1


What your command is trying to do is replace the nearest player whose player name is tnt's mainhand slot. Because your Minecraft username isn't tnt, it is not finding you.

Unfortunately, it isn't possible to detect an item in a specific item slot in Minecraft Bedrock. You can, however, run /clear @p tnt -1 1 to clear a TNT from a player, and test whether it succeeds using a conditional chain command block.

  • can you give an example for that chained block.Like, how does it detect the succeded clearing? Jan 24, 2021 at 21:34
  • yes. The green command blocks Jan 24, 2021 at 21:38
  • so: impulse command block: unconditional, always active "clear @p tnt -1 1" > > chain command block: conditional, always active "give @p "special tnt"" Jan 24, 2021 at 21:44
  • OMG. It worked, first it didnt because the arrow wasnt pointing to the chain block. But now it works, Thank you! Jan 24, 2021 at 21:46
  • Btw, can the "impulse command block" be a repeat one? or do i have to make a redstone clock that runs into it? Jan 24, 2021 at 21:47

You must log in to answer this question.

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