Jump to content

[1.14.4] send packet to client


andGarrett

Recommended Posts

I'm trying to Sync up a server-side player capability with a client-side player capability. I don't know what I should send the packet to. I tried the player but I don't know exactly how to use the "sendTo" method. I tried:

MerchantcraftPacketHandler.channel.sendTo(new SyncBalancePacketToClient(b), ???, NetworkDirection.PLAY_TO_CLIENT);

 

I have no idea how to work with NetworkManager (the second parameter), and I'm not even sure about "NetworkDirection.PLAY_TO_CLIENT".

Link to comment
Share on other sites

11 hours ago, diesieben07 said:

You should use send and PacketDistributor.

Example:
channel.send(PacketDistributor.PLAYER.with(yourTargetPlayer), msg).

 

There are more distributors available that allow you to e.g. send to a whole dimension.

If it's not to much trouble, could you or anyone who knows explain why this would be the preferred way to send such a packet?

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.