ClientPlayNetworking

public final class ClientPlayNetworking

Offers access to play stage client-side networking functionalities.

Client-side networking functionalities include receiving clientbound packets, sending serverbound packets, and events related to client-side network handlers.

This class should be only used on the physical client and for the logical client.

See also

Types

PlayChannelHandler
Link copied to clipboard
public interface PlayChannelHandler

Functions

canSend
Link copied to clipboard
static boolean canSend(Identifier channelName)
Checks if the connected server declared the ability to receive a packet on a specified channel name.
createC2SPacket
Link copied to clipboard
static Packet<? extends ObjectcreateC2SPacket(Identifier channelName, PacketByteBuf buf)
Creates a packet which may be sent to a the connected server.
getGlobalReceivers
Link copied to clipboard
static Set<IdentifiergetGlobalReceivers()
Gets all channel names which global receivers are registered for.A global receiver is registered to all connections, in the present and future.
getReceived
Link copied to clipboard
static Set<IdentifiergetReceived()
Gets all the channel names that the client can receive packets on.
getSendable
Link copied to clipboard
static Set<IdentifiergetSendable()
Gets all channel names that the connected server declared the ability to receive a packets on.
getSender
Link copied to clipboard
static PacketSender getSender()
Gets the packet sender which sends packets to the connected server.
registerGlobalReceiver
Link copied to clipboard
static boolean registerGlobalReceiver(Identifier channelName, ClientPlayNetworking.PlayChannelHandler channelHandler)
Registers a handler to a channel.A global receiver is registered to all connections, in the present and future.
registerReceiver
Link copied to clipboard
static boolean registerReceiver(Identifier channelName, ClientPlayNetworking.PlayChannelHandler channelHandler)
Registers a handler to a channel.
send
Link copied to clipboard
static void send(Identifier channelName, PacketByteBuf buf)
Sends a packet to the connected server.
unregisterGlobalReceiver
Link copied to clipboard
@Nullable()
static ClientPlayNetworking.PlayChannelHandler unregisterGlobalReceiver(Identifier channelName)
Removes the handler of a channel.A global receiver is registered to all connections, in the present and future.
unregisterReceiver
Link copied to clipboard
@Nullable()
static ClientPlayNetworking.PlayChannelHandler unregisterReceiver(Identifier channelName)
Removes the handler of a channel.

Sources

jvm source
Link copied to clipboard