How to spawn tamed creature?

Started by b.ART.ek on

Topic category: Help with MCreator software

Last seen on 14:53, 28. Mar 2024
Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to spawn tamed creature?

Is there a way to spawn creature that will be already tamed by player?

Since it is not possible to make mob sit, grow without becoming a new entity, I thought about making entity that would change into version that's not moving when right clicked, and turn into walking state when right clicked again. Sadly I can't find a way to make entity tamed when right after spawning. Is there something I'm missing? 
Please tell me.

Last seen on 07:01, 30. May 2022
Joined Apr 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i also need help with…
Sat, 04/23/2022 - 09:50

i also need help with something like this im trying to make a mob that when spawned it is already tamed by the player that spawned it with a item

Last seen on 06:22, 13. Mar 2023
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Bartek: I would need to know…
Wed, 05/04/2022 - 09:23

Bartek: I would need to know more to help more. It depends how you are spawning the entity.. There are multiple ways to do this depending on exactly what you're looking for, but if you want it to be tamed naturally on spawn it sounds like something like this would only work for single player if you want it to be tamed. 

Alternatively, you can add logic to the AI of your entity if your using custom AI in mcreator. Add a logic procedure to turn it off with a dataTag that is set to true or false on right click the entity. This would be the easiest way if you want a multiplayer mod to stop a mob from moving. This isn't technically sitting, but you can add a sitting animation to it using other procedures, and it is pretty much the same exact concept if you do that.

If you want it to be a singleplayer only mod, you can add a procedure with global trigger entity spawns and check if it is your entity, and then tame then using entity iterator get every player in the world and tame the event/target entity by entity iterator.

 

 

Roy:  It depends how you are spawning the entity. I would need to know more here also. If you are spawning it with a custom item and procedure, You would be able to execute a /summon command, and combine stuff using the create text procedure. I found this online but I don't know if it would apply to custom entities I haven't tested it. 

"The syntax to summon a tamed wolf is "/summon wolf [pos] {Owner: <PlayerName>}" and for a tamed cat is "/summon cat [pos] {Owner:<PlayerName>}"."

Based on the above it sounds like you could maybe use the /data command for this but I'm unsure.

The easiest way, idk about the simplest way, would be to use the UUID plugin to get the UUID of the player using the item, save it as a data tag, pass it to the entity on spawn, then for every player in the world as entity iterator, compare the players uuid against that data tag and if true, tame the event/target entity by entity iterator. The UUID plugin is one of my absolute favorites, and it helps with a lot of stuff like this. I suggest playing around with that.