Jump to content

Recommended Posts

Posted

How do I get an entities ID client side? I'm trying to send a packet to the server to find the server side copy of the entity to get info from for the client side entity, but I can't figure out how to get the integer ID from the client side entity. Any ideas?

Posted

entity.getEntityId(), but what kind of info are you trying to get, and why do you need to send a packet from the client to the server? If it's your entity, you should either implement IEntityAdditionalSpawnData to get the extra data to the client when the entity spawns, or use DataWatcher or packets to keep whatever fields you are watching up-to-date on the client.

Posted

entity.getEntityId(), but what kind of info are you trying to get, and why do you need to send a packet from the client to the server? If it's your entity, you should either implement IEntityAdditionalSpawnData to get the extra data to the client when the entity spawns, or use DataWatcher or packets to keep whatever fields you are watching up-to-date on the client.

 

So the entity is basically a snowball (I copied the Throwable entity class and changed a few values to change how it flew). The throwable entity class has a Thrower value on it to track the entity that threw it, this is built into the vanilla throwable entity class too. I'm trying to do some calculations based on the thrower, yet, the client version of the entity doesn't register the thrower, only the server side entity does. Because of this, I keep getting null pointer exceptions! Would one of your suggestions help fix that?

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.