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

Hi everyone.

 

I've been studying the vanilla mob entities source lately. What's utilized frequently is the Datawatcher class. Now, I did some looking into it on my own and learned a bit about how it operates. (Which is I believe to sync entities with the server) Despite that, I have a few questions of my own. Namely:

 

Is my premise on the purpose of Datawatcher incorrect? Please correct me if so/

 

If that is not the case, and Datawatcher is responsible for syncing entities, is it possible to substitute and instead utilize packets?

 

Thanks, I very much appreciate any insight!

 

 

 

 

 

 

No, then yes, but keep in mind that datawatcher is a built-in solution (so it works faster and is globally easier to use, but may conflict with vanilla entities) while packets are custom (separate, but slower...).

To add to that, I've previously tried to sync server- and client sided entities with packets, but I wasn't able to figure out how to add info in the packet that would identify for which entity the packet was for. There is a thing in entities called the EntityID, but these are different for the client and server (as far as I tested it). Sending the position of the entity with the packet is unreliable, as these are one of the variables that need to be synched, plus it could be very possible that there are two entities at the same position.

 

After all this messing around I found out what datawatchers do ;).

Author of PneumaticCraft, MineChess, Minesweeper Mod and Sokoban Mod. Visit www.minemaarten.com to take a look at them.

Isn't that the brand new ID used in entity attributes? And isn't that the same for every entity of the same type? But I haven't tested that myself either. Let's stick with datawatchers ;).

Author of PneumaticCraft, MineChess, Minesweeper Mod and Sokoban Mod. Visit www.minemaarten.com to take a look at them.

wait wait, you guys telling me that entityID ISNT always refering the same entity server and client side ?

 

like suppose i spawn a new derpysquid entity, it *might* not have the same entityID on both side, if not what are you suppose to use to sync entities ? (you mentionned a UUID earlier :\)

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

  • Author

Hmm, I was under the impression that each entity had a already unique ID in the world's "loadedentitylist"? Well, perhaps, not the actual entity ID, but rather a hashcode?

 

Anyhow, I'd actually prefer not to use datawatchers. Primarily reason being, like Goto said, most are already occupied by vanilla mobs.

 

Isn't entityId unique to each instance of an entity, but matched between client and server?

 

It is possible to send packets to sync data between. See this tutorial (

)

Then I've confused some of you. Sorry for that! I must have done something wrong whilst testing.

Author of PneumaticCraft, MineChess, Minesweeper Mod and Sokoban Mod. Visit www.minemaarten.com to take a look at them.

@airGamer well i was using entityID so far to sync between client/server but if its not the right way then my mod has possibly some HUGE bug right now :\

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

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.