Jump to content

[1.13.2] Send extra information to an Entity's doRender method


Recommended Posts

I want to change how an Entity is rendered based on some conditions in the world when it's spawned. I tried adding a Tag to it right before calling spawnEntity, but then, in the Entity's doRender method, the size of the tags is 0.


Here's what I tried with the Tags.

toSpawn.addTag(message.blockSide); // message.blockSide is a string that tells what side of a block it's being spawned on


Then, in the Entity's rendering class' doRender method:

Set<String> tags = entity.getTags();
System.out.println("Tags length: " + tags.size()); // Prints "Tags length: 0"


What are some ways I can accomplish this?

Link to comment
Share on other sites

Okay, looking over tags I can't find any explanation of how they're used.


However, I did suddenly realize that I could store the information in the entity's class... except, I can't. When I try to access what I've stored it's null, which means that the instance of the Entity used in doRender and the instance used when I spawn it in the world are two different ones, even when I store it in the entity's class after it's spawned.


I'm not quite sure what to do now!

Link to comment
Share on other sites

9 hours ago, diesieben07 said:

If the data does not change and only needs to be sent at spawn you can implement IEntityAdditionalSpawnData on your entity instead.

Awesome, that's what I need! I spent a while looking at Capabilities, but I guess that's not the solution. I'll take a look at IEntityAdditionalSpawnData!


Thanks! :)


Link to comment
Share on other sites

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.

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.


  • Create New...

Important Information

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