Jump to content

General Client-Serverside Questions


ItsAMysteriousYT

Recommended Posts

Hey there, i have some questions related to minecraft(-forge)'s Client/Serverside workflow. They might sound weird, but i better ask than struggle with things that won't work the way i want them too:

1. When i set a value on Client, will it be sinqued on server automaticly(SOmetimes it seems like cuz there is no packethandling stuff)

2. Is it possible to say other entities to update their information about one entity from this one entity

3. Is there a possibility to create a packethandler for all of my packets and if yes - how (I know this is more or less java related)

Link to comment
Share on other sites

1. No, unless the code also runs on the server and it sets the value to the same thing - not the same as synchronization, but often used by vanilla to make things 'snappier' on the client side.

 

2. Yes, you can send packets to all entities tracking a given entity using

((WorldServer) worldObj).getEntityTracker().sendToAllTrackingEntity(entity, packet)

; DataWatcher does this for you automatically.

 

3. Yes and no - you can write an abstract message class or interface that all of your packets inherit from that has a method to allow them to process themselves, then write a generic packet handler that calls that method. So you have a generic packet handler, but all it does is ask the packet to take care of the actual handling - this is the approach I use, but YMMV.

Link to comment
Share on other sites

1. No, unless the code also runs on the server and it sets the value to the same thing - not the same as synchronization, but often used by vanilla to make things 'snappier' on the client side.

 

2. Yes, you can send packets to all entities tracking a given entity using

((WorldServer) worldObj).getEntityTracker().sendToAllTrackingEntity(entity, packet)

; DataWatcher does this for you automatically.

 

3. Yes and no - you can write an abstract message class or interface that all of your packets inherit from that has a method to allow them to process themselves, then write a generic packet handler that calls that method. So you have a generic packet handler, but all it does is ask the packet to take care of the actual handling - this is the approach I use, but YMMV.

 

Sorry, but what you mean with ymmv?

Link to comment
Share on other sites

By the way for Question #1, the client does sync some stuff to the server, namely key press and GUi container stuff. For example, even though you don't see it, if you use a GuiContainer when you take things from the slots and such that information does get synced to server. And of course if you move on the client the server needs to know that so it is synced for you. But as mentioned by CoolAlias, a large body of the functionality just runs in parallel and so is not explicitly synced.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.