Class ClientPlayNetworkAddon
java.lang.Object
net.fabricmc.fabric.impl.networking.AbstractNetworkAddon<ClientPlayNetworking.PlayPayloadHandler<?>>
net.fabricmc.fabric.impl.networking.AbstractChanneledNetworkAddon<ClientPlayNetworking.PlayPayloadHandler<?>>
net.fabricmc.fabric.impl.networking.client.ClientPlayNetworkAddon
- All Implemented Interfaces:
PacketSender, CommonPacketHandler
public final class ClientPlayNetworkAddon
extends AbstractChanneledNetworkAddon<ClientPlayNetworking.PlayPayloadHandler<?>>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final net.minecraft.client.Minecraftprotected booleanprotected final net.minecraft.client.multiplayer.ClientPacketListenerFields inherited from class AbstractChanneledNetworkAddon
commonVersion, connection, receiver, sendableChannelsFields inherited from class AbstractNetworkAddon
logger -
Constructor Summary
ConstructorsConstructorDescriptionClientPlayNetworkAddon(net.minecraft.client.multiplayer.ClientPacketListener listener, net.minecraft.client.Minecraft client) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.network.protocol.Packet<?> createPacket(net.minecraft.network.protocol.common.custom.CustomPacketPayload packet) Creates a packet from a packet payload.protected voidhandleRegistration(net.minecraft.resources.Identifier channelName) protected voidhandleUnregistration(net.minecraft.resources.Identifier channelName) protected voidprotected voidprotected voidinvokeRegisterEvent(List<net.minecraft.resources.Identifier> ids) protected voidinvokeUnregisterEvent(List<net.minecraft.resources.Identifier> ids) protected booleanprotected booleanisReservedChannel(net.minecraft.resources.Identifier channelName) Checks if a channel is considered a "reserved" channel.voidprotected voidreceive(ClientPlayNetworking.PlayPayloadHandler<?> handler, net.minecraft.network.protocol.common.custom.CustomPacketPayload payload) protected voidSchedules a task to run on the main thread.Methods inherited from class AbstractChanneledNetworkAddon
createRegisterPayload, createRegistrationPayload, disconnect, getNegotiatedVersion, getSendableChannels, handle, onCommonRegisterPacket, onCommonVersionPacket, receiveRegistration, registerPendingChannels, sendInitialChannelRegistrationPacket, sendPacketMethods inherited from class AbstractNetworkAddon
endSession, getHandler, getReceivableChannels, handleDisconnect, lateInit, registerChannel, registerChannels, unregisterChannelMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface PacketSender
sendPacket, sendPacket, sendPacket
-
Field Details
-
listener
protected final net.minecraft.client.multiplayer.ClientPacketListener listener -
client
protected final net.minecraft.client.Minecraft client -
isServerReady
protected boolean isServerReady
-
-
Constructor Details
-
ClientPlayNetworkAddon
public ClientPlayNetworkAddon(net.minecraft.client.multiplayer.ClientPacketListener listener, net.minecraft.client.Minecraft client)
-
-
Method Details
-
invokeInitEvent
protected void invokeInitEvent()- Specified by:
invokeInitEventin classAbstractNetworkAddon<ClientPlayNetworking.PlayPayloadHandler<?>>
-
onServerReady
public void onServerReady() -
isOnReceiveThread
protected boolean isOnReceiveThread()- Specified by:
isOnReceiveThreadin classAbstractChanneledNetworkAddon<ClientPlayNetworking.PlayPayloadHandler<?>>
-
receive
protected void receive(ClientPlayNetworking.PlayPayloadHandler<?> handler, net.minecraft.network.protocol.common.custom.CustomPacketPayload payload) - Specified by:
receivein classAbstractChanneledNetworkAddon<ClientPlayNetworking.PlayPayloadHandler<?>>
-
createPacket
public net.minecraft.network.protocol.Packet<?> createPacket(net.minecraft.network.protocol.common.custom.CustomPacketPayload packet) Description copied from interface:PacketSenderCreates a packet from a packet payload.- Parameters:
packet- the packet payload
-
invokeRegisterEvent
- Specified by:
invokeRegisterEventin classAbstractChanneledNetworkAddon<ClientPlayNetworking.PlayPayloadHandler<?>>
-
invokeUnregisterEvent
- Specified by:
invokeUnregisterEventin classAbstractChanneledNetworkAddon<ClientPlayNetworking.PlayPayloadHandler<?>>
-
invokeDisconnectEvent
protected void invokeDisconnectEvent()- Specified by:
invokeDisconnectEventin classAbstractNetworkAddon<ClientPlayNetworking.PlayPayloadHandler<?>>
-
handleRegistration
protected void handleRegistration(net.minecraft.resources.Identifier channelName) - Specified by:
handleRegistrationin classAbstractNetworkAddon<H>
-
handleUnregistration
protected void handleUnregistration(net.minecraft.resources.Identifier channelName) - Specified by:
handleUnregistrationin classAbstractNetworkAddon<H>
-
isReservedChannel
protected boolean isReservedChannel(net.minecraft.resources.Identifier channelName) Description copied from class:AbstractNetworkAddonChecks if a channel is considered a "reserved" channel. A reserved channel such as "minecraft:(un)register" has special handling and should not have any channel handlers registered for it.- Specified by:
isReservedChannelin classAbstractNetworkAddon<H>- Parameters:
channelName- the channel name- Returns:
- whether the channel is reserved
-
schedule
Description copied from class:AbstractChanneledNetworkAddonSchedules a task to run on the main thread.- Specified by:
schedulein classAbstractChanneledNetworkAddon<H>
-