Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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?

 

 

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

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.

Never used the spawn data deal.  I'll have to look that up

Long time Bukkit & Forge Programmer

Happy to try and help

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.