1

Get the Color of a Tamed Wolf's Collar?

Drake__archer's Avatar Drake__archer1/22/24 6:58 pm
1 emeralds 175 5
1/23/2024 5:20 pm
Drake__archer's Avatar Drake__archer
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!
Posted by Drake__archer's Avatar
Drake__archer
Level 11 : Journeyman Modder
9

Create an account or sign in to comment.

5

michaelo
01/23/2024 8:03 am
Level 32 : Artisan Chef
michaelo's Avatar
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.
2
Drake__archer
01/23/2024 9:01 am
Level 11 : Journeyman Modder
Drake__archer's Avatar
could you give me the command i would need to use?
1
michaelo
01/23/2024 4:30 pm
Level 32 : Artisan Chef
history
michaelo's Avatar
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
2
Drake__archer
01/23/2024 5:20 pm
Level 11 : Journeyman Modder
Drake__archer's Avatar
THANKY OU SO MUCH! I HAVE BEEN STUCK ON THIS FOR DAYSSSZDSFKSJNGCV!!!!!!!!!!!!!!!1111111
2
imalittlhigh
01/23/2024 3:44 am
Level 62 : High Grandmaster Sweetheart
imalittlhigh's Avatar
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
1
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome