I'm at my wit's end on this one. I've prowled here for solutions and found parts that helped do what I needed but it gets stuck on this specific part.
I am trying to create a string of command blocks that detects a custom item held, teleports the holder to spawn, tags them, removes 1 of the item from all tagged players, then untags them. The tags simply coming into play because all other methods I had been attempting don't work.
Simplified commands as suggested by @Fabian:
CB 1: /execute as @a[nbt={SelectedItem:{id:"minecraft:scute"}] run teleport -274 77 324
CB 2: /execute as @a[nbt={SelectedItem:{id:"minecraft:scute"}] run tag @s[nbt={SelectedItem:{id:"minecraft:scute",tag}] add skoot
CB 3: clear @a[tag=skoot] minecraft:scute 1
CB 4: execute as @a[tag=skoot] run tag @s remove skoot
The problem I am running into is CB 3, as the clear will not detect the held item or copies of it in the inventory (to check if it works at all). I can't see what I'm doing wrong on it, as the specifications are identical to the previous commands.
Any help pointing out how I can get this thing to work would be greatly appreciated.
}
on all NBT selectors. But I guess you didn't have that in the game, since you would have gotten a pretty descriptive error message otherwise. Please either enter the exact commands you used in the game or use the exact commands you wrote here. Ctrl+C, Ctrl+V. Also you have a lonetag
, which does nothing except giving an error message. Not sure what that's for. 3. Your check in the second command is duplicated. Just use@s
the second time, or, if thetag
thing is meant to be something, then@s[tag=<whatever>]
. Or just leave out the… – Fabian Röling Oct 25 '18 at 19:40