Package-level declarations

Utilities for creating client-to-server and server-to-client packets

Types

Link copied to clipboard
sealed class AbstractPacketDefinition<T : Any, C>

Abstraction of server-to-client and client-to-server packets. See ServerToClientPacketDefinition and ClientToServerPacketDefinition. Additionally, this class is partially the basis of ClientToClientPacketDefinition.

Link copied to clipboard
class ClientPacketContext(val client: Minecraft = Minecraft.getInstance())
Link copied to clipboard
class ClientToClientPacketDefinition<T : Any>(id: ResourceLocation, binaryFormat: BinaryFormat, deserializer: KSerializer<T>) : AbstractPacketDefinition<T, ClientPacketContext>

See c2cPacket function, which constructs this packet definition class.

Link copied to clipboard
class ClientToServerPacketDefinition<T : Any>(id: ResourceLocation, binaryFormat: BinaryFormat, deserializer: KSerializer<T>) : AbstractPacketDefinition<T, ServerPacketContext>

See c2sPacket function, which constructs this packet definition class.

Link copied to clipboard
class ServerPacketContext(val server: MinecraftServer, val player: ServerPlayer, val handler: ServerGamePacketListenerImpl)
Link copied to clipboard

Used by the ClientToClientPacketDefinition, which requires a server-side forwarder.

Link copied to clipboard
class ServerToClientPacketDefinition<T : Any>(id: ResourceLocation, binaryFormat: BinaryFormat, deserializer: KSerializer<T>) : AbstractPacketDefinition<T, ClientPacketContext>

See s2cPacket function, which constructs this packet definition class.

Functions

Link copied to clipboard
inline fun <T : Any> c2cPacket(id: ResourceLocation, format: BinaryFormat = Cbor): ClientToClientPacketDefinition<T>

Creates a new ClientToClientPacketDefinition. This packet can only be sent from the client to another client. The server will act as the middle man, it is responsible for forwarding this packet. The packet can only be sent in a typesafe way. The type is specified by T.

Link copied to clipboard
inline fun <T : Any> c2sPacket(id: ResourceLocation, format: BinaryFormat = Cbor): ClientToServerPacketDefinition<T>

Creates a new ClientToServerPacketDefinition. This packet can only be sent from the client to the current server. The packet can only be sent in a typesafe way. The type is specified by T.

Link copied to clipboard
inline fun <T : Any> s2cPacket(id: ResourceLocation, format: BinaryFormat = Cbor): ServerToClientPacketDefinition<T>

Creates a new ServerToClientPacketDefinition. This packet can only be sent from the server to one or multiple clients. The packet can only be sent in a typesafe way. The type is specified by T.