WorldsEnder Posted July 9, 2014 Posted July 9, 2014 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? Quote
delpi Posted July 9, 2014 Posted July 9, 2014 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. Quote Long time Bukkit & Forge Programmer Happy to try and help
GotoLink Posted July 9, 2014 Posted July 9, 2014 DataWatcher has limited number of values storable. See its constructor. IAdditionalSpawnData deals with data on spawn shared on both sides. It sends its own packet so you don't have to worry about it. Quote
delpi Posted July 10, 2014 Posted July 10, 2014 Never used the spawn data deal. I'll have to look that up Quote Long time Bukkit & Forge Programmer Happy to try and help
Recommended Posts
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.