I've been trying to detect the use of a custom Carrot on a stick using scoreboards.
The way I'm doing this is by spawning one with a custom model, name and tag:
give @p carrot_on_a_stick{display:{Name:'"Rubick"'},CustomModelData:963,Rubick:1b}
Then I add a new scoreboard objective:
scoreboard objectives add rubiclick minecraft.used:minecraft.carrot_on_a_stick
Where I then use to detect if the player used the item but I use the detection to also make sure it has either the custom name, OR tag:
execute as @a[scores={rubiclick=1..},nbt={SelectedItem:{id:"minecraft:carrot_on_a_stick"},tag:{display:{Name:'"Rubick"'}}}] at @s run effect give @a weakness 1 1 false
or
execute as @a[scores={rubiclick=1..},nbt={SelectedItem:{id:"minecraft:carrot_on_a_stick"},tag:"Rubick:1b"}] at @s run effect give @a weakness 1 1 false
but neither method seems to work, yet I can detect a regular Carrot on a stick use with:
execute as @a[scores={rubiclick=1..},nbt={SelectedItem:{id:"minecraft:carrot_on_a_stick"}}] at @s run effect give @a weakness 1 1 false
Does anyone know what I'm doing wrong here?