How to make an entity give/pass on a name tag to another entity

Started by CoolCaution on

Topic category: Help with Minecraft modding (Java Edition)

Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make an entity give/pass on a name tag to another entity
Mon, 12/27/2021 - 21:08 (edited)

Ok so, Im making a entity (but technically multiple entities) that go through 3 stages of growth/ageing, (baby, teen, adult and possibly elder) I've made 3 different entities for the 3 different growth stages but one thing I really want to implement a way to name the baby once its born and have them keep that name til they grow old and die. is there any way to make an entity give/pass on a name to another entity when it despawns?

Edited by CoolCaution on Mon, 12/27/2021 - 21:08
Joined Dec 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yes, it is possible to do so…
Tue, 12/28/2021 - 07:50

Yes, it is possible to do so.

 

When you despawn the entity and spawn in the new entity do "if get nearest entity (name of the entity your spawning" inside of "is sub type of (name of your entity)". This is done to help prevent potential crashing if the game searches for an entity that doesn't exist. For the block radius, set 1 for all of the procedures

Inside of the if statement put another if statement and do "if get event/target entity display name doesn't equal (name of your entity)". Inside of this if statement do "set display name of (get nearest entity) to get event/target entity display name"

 

I'd you are still having issues or are struggling to understand what I said, feel free to ask any questions

Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok I kind of got confused at…
Wed, 12/29/2021 - 03:37

Ok I kind of got confused at the beginning lol, the "if get nearest entity part if you could explain that different because i'm not sure what you mean. 

Joined Dec 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So, grab an "is (event…
Wed, 12/29/2021 - 20:09

So, grab an "is (event/target entity subtype of (name of entity)" procedure. Remove the "event/target entity" part and replace it with "get nearest entity (name of your entity) at x y z in radius 4"... Change the radius to be "1". Grab an "if" stament procedure and place this whole procedure inside of the "if" part of the if stament.

Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
ok i put it together and…
Wed, 12/29/2021 - 20:28

ok i put it together and which "event/target" slot do I put the 1st entity/entity despawning and the 2nd entity/entity being spawned?

 

Joined Dec 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Here is a screenshot of an…
Wed, 12/29/2021 - 21:18

Here is a screenshot of an example procedure. The "spawn at" procedure will likely look different than yours since I set it to "external inputs" so that it'd fit on the screen in a screenshot.  

 

Replace the "Animal Entity" part with the name of the entity you're trying to spawn in. Replace the "NAME OF YOUR ENTITY" part with whatever you set your entity's name to in the "visual and sounds" section of your living entity. 

 

If you didn't have the "if no get display name of event/target entity= NAME OF YOUR ENTITY" part, it'd set the name of the entity you're spawning in to be your original entity's name and you only want it to pass on the display name if the entity has been named with a nametag or such (I think?).

Nametag

Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
THANK YOU it was kinda hard…
Wed, 12/29/2021 - 21:39

THANK YOU it was kinda hard to visualize what you were saying but now i understand, and yes, the entity/entities im making dont spawn with names but when they do spawn as baby's and you name one I just want them to keep the name after they grow up. Again THANK YOU!!!!

Joined Dec 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You're welcome! Also, I didn…
Wed, 12/29/2021 - 21:50

You're welcome! Also, I didn't clearly mention this, but the NAME OF YOUR ENTITY part, should be the name of your original entity, the one you're despawning. Since your entity technically does have a name (you set one when you create the entity, it just doesn't show like a nametag does), you don't want it to set the display name of your entity to something unless it isn't the default name (which means they used a nametag)

Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok so i'm not sure what you…
Thu, 12/30/2021 - 00:42

Ok so i'm not sure what you mean by "entity technically does have a name" can you use and example of one of your entities because i'm kinda stuck. The game crashes if the entity ages up without a name but with a name it works fine. I know you said to ut part of the procedure in the code to stop this from happening but I can get the procedure to work the way I want it to (ageing up the entity even if it doesn't have a name) but now I don't know how to age an entity without a name with out having to give it a name.

Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Nevermind I figured…
Thu, 12/30/2021 - 17:23

Nevermind I figured something else out thanks for the help :)

Joined Dec 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Sorry I didn't see your…
Sat, 01/01/2022 - 03:22

Sorry I didn't see your comment sooner. I'm glad you got it figured out!

Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hey, how have you fixed the…
Sun, 12/25/2022 - 22:40

Hey, how have you fixed the issue with entity aging up?