Skip to content

Interface IMinecraftPacketMessageStream

Namespace: Void.Minecraft.Network.Streams.Packet
Assembly: Void.Minecraft.dll

Defines synchronous and asynchronous I/O for decoded Minecraft packets.

public interface IMinecraftPacketMessageStream : IMinecraftStream, IMessageStream, IMessageStreamBase, IDisposable, IAsyncDisposable

Implements

IMinecraftStream, IMessageStream, IMessageStreamBase, IDisposable, IAsyncDisposable

Properties

Registries

Gets the packet identifier and transformation registries used by the stream.

IRegistryHolder Registries { get; }

Property Value

IRegistryHolder

Methods

ReadPacket()

Reads and decodes the next packet from the underlying stream.

IMinecraftPacket ReadPacket()

Returns

IMinecraftPacket

The decoded packet. The caller is responsible for its disposal.

ReadPacketAsync(CancellationToken)

Asynchronously reads and decodes the next packet from the underlying stream.

ValueTask<IMinecraftPacket> ReadPacketAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token used to cancel packet input.

Returns

ValueTask<IMinecraftPacket>

The decoded packet. The caller is responsible for its disposal.

WritePacket(IMinecraftPacket)

Encodes and writes a packet to the underlying stream.

void WritePacket(IMinecraftPacket packet)

Parameters

packet IMinecraftPacket

The packet to encode and write.

WritePacketAsync(IMinecraftPacket, CancellationToken)

Asynchronously encodes and writes a packet to the underlying stream.

ValueTask WritePacketAsync(IMinecraftPacket packet, CancellationToken cancellationToken = default)

Parameters

packet IMinecraftPacket

The packet to encode and write.

cancellationToken CancellationToken

A token used to cancel packet output.

Returns

ValueTask

A task that completes when the packet has been written.