Jump to content

applyEntityAttributes vs entityInit aka. dataWatcher vs EntityAttributes


WorldsEnder

Recommended Posts

As the title says: what are the difference between the two methods? As far as I know the two methods applyEntityAttributes and entityInit are pretty much equally when dealing with EntityLiving and difference is semantically that you assign data to the dataWatcher in entityInit() and entityAttributes in applyEntityAttributes. Is that correct?

 

This leads to the question what the difference bewtween the DataWatcher and EntityAttributes is?

- Which should I use when?

- Do they both get updated automatically Server/Client?

 

And a last question: How can I set a random variable at spawn that doesn't change but is the same on both Server and Client?

 

 

Link to comment
Share on other sites

entityAttributes will not sync client to server.  Whatever you put there will be set on both client and server when the class initializes.  If you change one later, it will no longer be the same unless you pass it along ot the other side.

 

Datawatcher handles the passing of a variable from server to client (normally) in a minecraft sort of way instead of you doing your own packets.

 

For your random, you should generate it on the server and then pass to client via a datawatcher or a custom packet.

Long time Bukkit & Forge Programmer

Happy to try and help

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.

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.