Jump to content

Recommended Posts

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!

 

 

 

 

 

 

Posted

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

Posted

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.

Posted

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.

Posted

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-

Posted

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.

 

Posted

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 (

)
Posted

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.

Posted

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

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