How and where can I save the identity of a mob's owner?

Started by James Sylar on

Topic category: Help with MCreator software

Last seen on 05:23, 7. Jul 2021
Joined Feb 2019

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How and where can I save the identity of a mob's owner?

Good afternoon, I'm THIS close to achieve something I have been wanting to do for a long time, a companion mob, with several "modes", but I'm having troubles with one step. 

The mod:

I have a mob that appears in the wilderness, and can be tamed by giving them an item, they get healed if they are given the same item. If you right click on them with a stick they stay in place, this is made by swapping the mob to another exactly the same but with 0 movement. A problem I found is that that makes them not tamed again, since it is technically another individual, but it is easy just to make it being tame to the one who right clicked it. Now, I made it so when either of those modes are hurt, they become "aggressive", but that's the problem. 

The problem: 

Since they become agressive when they are hurt, the player isn't interacting with them in any way, so I can't do the same for the STAY mode. I'm thinking maybe I can save who the owner of the mob is before swapping them, "Get owner of Entity if it is tamed"  and then after it has been swapped to tame them to where I saved that, but I don't know where to save them, NBT tags don't seem to work, nor do variables.

Does someone has any idea how to make this work?