This setup works:
One of your items is an arrow, the other is any non-dispensing item like redstone.
Arrows will fire and miss the tripwire. Items will hit it then burn up, triggering a signal. You can use the items you suggested: arrow, cobble, cobble, arrow and the desired signal will be generated (well, the inverse).
or you simply canāt use exclamation marks in NBT tags
This is the case unfortunately. Using !
for negation only works in selectors, and even then only for certain arguments (type
, name
, tag
, team
, m
).
The problem is, that when I move far away from the setup, the redstone stops working, leaving me unable to summon any new fireballs. Instead, I'm trying to use a command block to check when anything except for item is being held;
If I'm understanding correctly, this problem won't be solved by changing your commands if they already do the correct thing when you're near them.
You should instead move your contraption to spawn chunks (which are always loaded) or keep the chunks your contraption is in loaded with a chunk loader.
how I can check for anything except for a specific item?
Your original commands will leave players not holding the item with a score of 0, meaning you can do something like:
/scoreboard players add @a Fireball 1 {SelectedItem:{tag:{display:{Name:"Summon Fireball"}}}}
/execute @a[score_Fireball_min=1,score_Fireball=1] ~ ~ ~ /summon Fireball ~ ~2.5 ~ {direction:[0.0,0.0,0.0]}
/execute @a[score_Fireball_min=0,score_Fireball=0] ~ ~ ~ /say I'm not holding the fireball summon item
/scoreboard players set @a Fireball 0
You can rearrange these commands slightly to have players be left with 0 or 1 at the end of the tick depending on whether they're holding the fireball, if you want:
/scoreboard players set @a Fireball 0
/scoreboard players add @a Fireball 1 {SelectedItem:{tag:{display:{Name:"Summon Fireball"}}}}
/execute @a[score_Fireball_min=1,score_Fireball=1] ~ ~ ~ /summon Fireball ~ ~2.5 ~ {direction:[0.0,0.0,0.0]}
/execute @a[score_Fireball_min=0,score_Fireball=0] ~ ~ ~ /say I'm not holding the fireball summon item
Further, Iāve tried using exclamation marks to set the score of all entities, including the ones with a blank score, but except for the ones with a score of 2 or higher, to 0;
The score_...
argument also unfortunately doesn't accept !
for negation. You'll instead need to do this in multiple steps:
- Add 0 to all scores, turning null scores to 0:
/scoreboard players add @e[type=Arrow] Arrows 0
- Do the command for arrows with
Arrows
score less than 2: @e[score_Arrows=1]
- Do the command for arrows with Arrows score more than 2:
@e[score_Arrows_min=3]
Best Answer
Since 1.14 this is possible relatively easily with the wandering trader. It has the
WanderTarget
NBT field that you can set to any coordinates to make it use its regular pathfinding to walk there.You need the
dummy
scoreboardsx
,y
andz
.Then you continuously teleport the rabbit to the wandering trader. When it's within about 2 blocks or so, kill the wandering trader.
The downside of this is that it won't hop. It will also not go exactly towards the target, because the wandering target stops about two blocks before its target coordinates. But maybe it's already good enough to teleport the rabbit the remaining distance. This system also only works properly at night, otherwise the wandering trader is visible. You could give it invisibility repeatedly, but then it will still show its milk bucket whenever it tries to get rid of the effect.
Thanks to "š¾ Aelicorn_v2 š¾" and "remy - 1.14" in the Minecraft commands Discord for their help with this answer (mainly the
as
vs.at
confusion).