1
Get the Color of a Tamed Wolf's Collar?
For my datapack, i need to be able to get and use the color of a wolf's collar, or its CollarColor NBT tag.
I tried using commands like /data get entity, but that didn't work, and i couldn't find anything else.
Is this even possible? If so, how would i go about doing it, and if not what could i do instead?
Any help would be greatly appreciated!
I tried using commands like /data get entity, but that didn't work, and i couldn't find anything else.
Is this even possible? If so, how would i go about doing it, and if not what could i do instead?
Any help would be greatly appreciated!
Create an account or sign in to comment.
5
What bit doesn't work for you? I've had to do this before and it worked alright, the annoying thing is the colour is stored as a number so you'll need to do a load of execute if checks to identify which one it is.
could you give me the command i would need to use?
execute store result score <variable> <objective> run data get entity @e[the dog] CollarColor
Then you run a command you want based on the score. You can check what colour each number is on the wiki https://minecraft.wiki/w/Wolf#Entity_data
execute if score <variable> <objective> matches 6 run ... whatever happens if the collar is pink
THANKY OU SO MUCH! I HAVE BEEN STUCK ON THIS FOR DAYSSSZDSFKSJNGCV!!!!!!!!!!!!!!!1111111
If there is no data in the wolfs nbt, would have to save the colour of the collar to the wolf when its applied by a player.
Detect the player using a dye on a tamed wolf, raycast to the wolf, and save the colour used in its tags.
The detection you can do with an advancement (generate here).
The raycast you can find good tutorials on youtube.
For the tag, you can just do /tag add ... , or you add an nbt tag to the dog
Detect the player using a dye on a tamed wolf, raycast to the wolf, and save the colour used in its tags.
The detection you can do with an advancement (generate here).
The raycast you can find good tutorials on youtube.
For the tag, you can just do /tag add ... , or you add an nbt tag to the dog