Jump to content

[1.12] Syncing ItemStack Capabilities


Notunknown

Recommended Posts

So I am creating a Capability for an ItemStack and have two major issues and a couple of questions:


The first issue is that the capabilities appear to sync fine, but the data flickers back to the default values on the client what appears to be randomly. On the server the values are always correct, however. I am thinking this is a serialization issue, but the serialization issue that I had in the past manifested itself differently to this (not being random).

I have checked the incoming packets used to sync the data, and they are correct.

 

The second issue is that I cannot figure out how to sync the item data for other players than the player who is holding the item. What is the best method for syncing this data to all players, regardless of whether the ItemStack is on the ground, in a container or being held by something?

 

Finally, I have a few questions regarding Capabilities and some other information:

 

First, the onUpdate for my Item is fairly simple and could be run on the client (at least partially). It only needs to be synced when the player picks up the ItemStack, drops it or opens a UI (all of which seem to also cause deserialization, so that would be the perfect time to sync). However, I cannot seem to figure out how to do this.

Secondly (not a Capabilities question, but doesn't seem worthy of a separate thread), are proxies still needed? I have references to client-only classes (such as a reference to Minecraft in the sync message) without the server exploding.

Link to comment
Share on other sites

The answer is always packets.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.