Draylar / identity

A modern morph mod for Fabric.
https://www.curseforge.com/minecraft/mc-mods/identity
MIT License
105 stars 45 forks source link

How to retrieve a player's identity using commands? #605

Closed morceaudebois closed 11 months ago

morceaudebois commented 11 months ago

Hi! Sorry if this isn't really a problem, but I'm not sure where else to ask.

I'm playing around with the Origins mod and I'm trying to add a canine origin with the ability to switch between human and wolf identities. I managed to do it but I would like to add a condition to toggle between the two with the same key.

I wanted to add a command condition to check for the player's identity before switching to wolf or human, but there doesn't seem to be a command in the Identity mod to get the player's identity.

I tried with /data get entity @s but it doesn't seem to be stored there. Is there a way I cloud retrieve it using a command?

Thank you!

ToCraft commented 11 months ago

Do you mean the current identity or any unlocked ones?

morceaudebois commented 11 months ago

Thanks for the reply. I mean the current equipped one

ToCraft commented 11 months ago

Try /identity test [player] [entity], to check, if [entity] is the current identity of [player]

morceaudebois commented 11 months ago

I actually found out about this yesterday while tinkering! Not gonna go into details but it wasn't really what I was looking for. For reference I ended up having to learn and use the /execute command, like this:

/execute if entity @s[nbt={CurrentIdentity:{id:"minecraft:wolf"}}]

Turns out the data I needed was in fact in the /data command, I just needed to look harder! Thanks again for the help 😊