Skip to content

Instantly share code, notes, and snippets.

@tryashtar
Last active April 22, 2022 06:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tryashtar/6504ef17c91ee2dcc1db7185a9ed5396 to your computer and use it in GitHub Desktop.
Save tryashtar/6504ef17c91ee2dcc1db7185a9ed5396 to your computer and use it in GitHub Desktop.
Attempting to check for empty hand with Bedrock's "hasitem" selector argument

Syntax Errors

hasitem={location=slot.weapon.mainhand}
hasitem={location=slot.weapon.mainhand,quantity=0}

  • Doesn't work: item must be specified

Air Item

hasitem={location=slot.weapon.mainhand,item=air}
hasitem={location=slot.weapon.mainhand,item=air,quantity=1..}

  • Doesn't work: doesn't find player with empty hand or with filled hand

hasitem={location=slot.weapon.mainhand,item=air,quantity=0}

  • Doesn't work: finds both player with empty hand and with filled hand

Some Other Item

hasitem={location=slot.weapon.mainhand,item=stone,quantity=0}

  • Doesn't work: doesn't find player holding stone, but finds player with empty hand or holding anything else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment