How does the Minecraft command work?

Ro
3

I want to create a puzzle map in Minecraft and need a command that checks whether the player has 20 emeralds and if so, another command is executed. Is that possible and if so how?

an

Place a repeating command block with

/ testfor @p {Inventory: [{id: "minecraft: emerald", Count: 20b}]}

You connect a comparator to this (to get an output) and route the output to another command block.

Or you can connect a chain command block that is only executed if the previous command block has been successfully executed.

Ro

Unfortunately the command does not work for the 1.16.4. Do you know a command that works for 1.16.4?

co

Yes 1.16.4 there's no longer testfor and testforblocks. Therefore there's only / execute

so what you mean is called detection try times in youtube there are instructions if "minecraft detect player item hand" or something ^^