Jump to content

Need help understanding MP TileEntities, Update Packets and all that stuff


Recommended Posts

Posted

Hi, I'm dAkshEN3. Some of you might recognise me from the BC forums. I created Advanced Power Systems and am currently in the process of updating it for the new MC and Forge. This also means I need to add multiplayer, which is where my problem arises:

 

I have no idea how the packets and such work to make GUIs and TileEntities and things work in multiplayer.

 

I'm not really looking for a tutorial or an example, I can handle the coding myself, I just need help understanding the theory and the process as I've never ventured into multiplayer game programming before.

"The hypothesis of God gives an incomparably absolute opportunity to understand everything and know absolutely nothing. Give man an extremely simplified system of the world and explain every phenomenon away on the basis of that system." - Arkady/Boris Strugatsky

 

Creator of Advanced Power Systems for BuildCraft

Posted

I would recommend looking at cpw's IronChests and CompactSolars mods as examples:  https://github.com/cpw

 

In essence though:

 

GUI:  You have a container on the server side, a GUI on the client side, they talk, plenty of examples in vanilla as to how, but usually it just works.

 

TileEntities:  You use the getDescriptionPacket call or whatever it was to send information to a TileEntity, you want to minimize the size and how often these occur, 'emulate' things on the client if possible, the lower network usage then the better.  :)

Posted

Ok, is there any circumstance where a TileEntity would need to send packets to the server?

"The hypothesis of God gives an incomparably absolute opportunity to understand everything and know absolutely nothing. Give man an extremely simplified system of the world and explain every phenomenon away on the basis of that system." - Arkady/Boris Strugatsky

 

Creator of Advanced Power Systems for BuildCraft

Posted

Ok, is there any circumstance where a TileEntity would need to send packets to the server?

yes when you edit something on the client per say a setting in a GUI you would need to tell the server that setting changed. For example TheCowGod's Locked doors and chest have player list to access. Every time someone add/remove a user to the block it send a packet to the server telling it to remove/add the player from its list as well.

 

https://github.com/TheCowGod/GreaterSecurity <- your welcome to use this as an example for making packets for both client and server.

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.