As of 1.9 you can use scoreboard add tag command to tag the player holding the specific item. You could use this tag in the item summon commands. If you are using a data pack, for better performance, a predicate should be used to detect holding an item in the main hand.
What inventory slot is the offhand?
offhand” (slot 99).
What is the command to clear inventory?
You can use the command /clear [targets] [item] [maxCount] , where: targets is optional. It is the name of the player (or a target selector) whose inventory you wish to clear. If no player is specified, it will default to the player running the command.
How to execute at a player holding a specific item in?
First off, put into the chat this command: Then, attach these commands to a repeating/chain command block string (in order) /scoreboard players set @a holding.gun 2 {SelectedItem: {id:snowball,tag: { put any other NBT tags in here }}}
Can you force a player to run a COMAND?
Click to expand… AFAIK commands aren’t executed async, so nobody can run a comand while the other has not fininshed (the reason why you should not set the current execution asleep), thus there is no backdoor! the_merciless That sends the command from the console, not the Player.
Is there a backdoor to force the player to run a command?
AFAIK commands aren’t executed async, so nobody can run a comand while the other has not fininshed (the reason why you should not set the current execution asleep), thus there is no backdoor! the_merciless That sends the command from the console, not the Player. A lot of commands are ignored if they are not sent from the Player.
How to test if a player is holding a stick?
Just use a comparator to test if a player is holding a stick, and then invert it (via a redstone torch) and have the inverted signal leading to a command block. Now, whenever the player is holding a stick, the signal is inverted and the second command block deactivates. share|improve this answer.