Jump to content

Recommended Posts

Posted (edited)

I have a custom entity(i use MCreator to make templates, and i edit the code myself)
im making a mob that can have different personalities, and that will change the behavior.
how I'm setting the personality is through an nbt tag.


i initially set this tag on the trigger that MCreator provides, onEntitySpawn, but this would trigger after the entities goals have already been set, so I changed it so that is called before the goals have been set. The problem is, that It is not working.
Is NBT data available this early in the definition?

this is the relevant code: (the null check is so that the personality is not changed if it already has been set, and GnomeOnInitialEntitySpawnProcedure() just calls a few things, including the personality assignment )


public String getPersonality() {

return this.getPersistentData().getString("Personality");

}

@Override

protected void registerGoals() {

String personality = this.getPersonality();

if(personality == null || personality.isEmpty()) {

GnomeOnInitialEntitySpawnProcedure.execute(this);

}

Edited by ElkMan3

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.