Jump to content

How to get server side capabilities and config from client?


Recommended Posts

Posted

Hello, I've attached some capabilities to players on server side, but I need that data to display in GUI. I know I'm supposed to sync it to client but it's a bit vague. Can someone give me few pointers or examples? I'm able to put all needed data in extraDataWriter while using NetworkHooks.openGui but I need to write another serializer/deserializer for capability data. Does syncing capability data allows me to skip that?

 

Also in the same GUI I need some config values that are set server-side, how can I access that? Is there a way to sync configs, or I need to use extraDataWriter for this?

Posted
1 hour ago, diesieben07 said:

No. "Syncing" describes exactly this process of sending some kind of network packet (that is what NetworkHooks.openGui does under the hood) containing the capability data.

I see, I thought there is some magic way to call player.getCapability() on client side and get the same results as on server side. Thanks, I know what to do now.

Posted

One more thing if I may ask. If I need to perfrom some action on that server side capabilities depending on user interaction in GUI, I need to send packet with message from client to 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.