Started by
jmods
on
Topic category: Help with Minecraft modding (Java Edition)
I'm basically trying to make a different drop for each color sheep but I can't seem to figure out how. I've seen the block "Get color of sheep..." but I'm unsure on how to use it, and can't seem to find anything that shows an example of using it
I'm pretty sure sheep color is an NBT tag. If it is, you just need to find the name of the tag, and you can access it with procedures. (So you could make a procedure that triggers when the entity dies, checks the tag, and uses it to determine which item to spawn.)
I can't figure out how to check the NBT tag for the color, do you have any ideas how I'd do that?
According to the wiki it's a numeric tag. (0 is white, 1 is orange, 2 is pink, etc), and the tag is just called 'Color.' My guess is you should be able to access it with the 'custom NBT tag' entity function. (If not, there are more needlessly complicated workarounds you could try involving the /data command...)
Im trying to do the same thing, but with wolves.
I have tried using the "custom NBT tag" thing, but it never works.
Since the color values for Wolves and Sheep are the same, could you send me a procedure that would get the color of the wolf, set a variable to it, and do something if the variable is equal to 0, 1, 2, 3, ect.
Then spectrejks would be able to use this same procedure but swap out the CollarColor tag for the Color tag.
If custom NBT isn't working, then you'll likely have to do a /data command of some sort. A procedure that triggers before the entity dies that runs a data command and returns a number. (Something like /data get entity @e[type=sheep,sort=nearest,limit=1] {Color}). The tricky part is getting the return value from the command, I'm not entirely sure how you'd do this.
It also might just be possible to make the loot table NBT dependent? I'm pretty sure there's loot tables that do this, but I haven't found any references to it in the documentation.
how would you get the return value from the command?
You would likely have to do it all using commands. You can run conditional commands with /execute, so you would need to write a command that drops the block if the sheep's color data equals a certain number. Again, I'm not super familiar with /execute, but I've heard Legitimoose has a decent tutorial. (Though the command may not be the best route, it's the only way I can think of to do this if the usual NBT procedures aren't returning anything.)