Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.15.2] Syncing capability to player client


Recommended Posts

Hey,

 

Basically, I'm modifying the player's reach with a command (changes reach value in the player's capability), and I need to sync this data to the client (because I want to show the attack indicator next to the cursor if the reach is long and the player is pointing at an entity).

Currently (and I'm sort of getting the vibe that I'm not doing this too correctly):

  • I send a packet to the client if the corresponding player has extended reach in the update event. This packet basically adds a custom string tag to the player's tag list (on the client) to let it know that this player does have extended reach. I only send this packet if this tag isn't in the player's tag list on the server.

 

I'm not the best at read and write and NBT stuff in Minecraft so any tips on how to correctly sync it would be appreciated

 

Thank you :)

Edited by Differentiation
Link to post
Share on other sites

Assuming you only need the client's own data on the client (i.e. PlayerX's client only needs PlayerX's data):

Send the data in PlayerLoggedInEvent, PlayerRespawnEvent, PlayerChangedDimensionEvent and whenever the data changes.

  • Thanks 1
Link to post
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.

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



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.