Skip to content

Interface IMinecraftPacketTransformationsRegistry

Namespace: Void.Minecraft.Network.Registries.Transformations
Assembly: Void.Minecraft.dll

Stores ordered upgrade and downgrade transformation pipelines by packet type.

public interface IMinecraftPacketTransformationsRegistry

Extension Methods

MinecraftPacketTransformationsExtensions.RegisterTransformations<T>(IMinecraftPacketTransformationsRegistry, ProtocolVersion, params IEnumerable<MinecraftPacketTransformationMapping>)

Properties

IsEmpty

Gets whether both upgrade and downgrade mapping tables are empty.

bool IsEmpty { get; }

Property Value

bool

PacketTypes

Gets the packet values that currently have transformation entries in this registry.

IEnumerable<Type> PacketTypes { get; }

Property Value

IEnumerable<Type>

Remarks

Callers that need a stable snapshot while the registry may be modified should materialize the sequence before enumerating it.

Methods

Add(IReadOnlyDictionary<IEnumerable<MinecraftPacketTransformationMapping>, Type>, ProtocolVersion)

Adds ordered upgrade and downgrade pipelines applicable beyond a protocol version.

IMinecraftPacketTransformationsRegistry Add(IReadOnlyDictionary<IEnumerable<MinecraftPacketTransformationMapping>, Type> mappings, ProtocolVersion protocolVersion)

Parameters

mappings IReadOnlyDictionary<IEnumerable<MinecraftPacketTransformationMapping>, Type>

Packet types keyed by their transformation mappings.

protocolVersion ProtocolVersion

The current protocol version used to filter mappings.

Returns

IMinecraftPacketTransformationsRegistry

This registry.

Exceptions

ArgumentException

The packet type already has a registered pipeline.

Clear()

Removes every upgrade and downgrade pipeline.

void Clear()

Clear(Direction)

Removes pipelines for packet types belonging to a protocol direction.

void Clear(Direction direction)

Parameters

direction Direction

The clientbound or serverbound direction to remove.

Exceptions

ArgumentOutOfRangeException

direction is not clientbound or serverbound.

Contains<T>(TransformationType)

Determines whether a transformation pipeline exists for a packet type.

bool Contains<T>(TransformationType type) where T : IMinecraftPacket

Parameters

type TransformationType

The upgrade or downgrade table to query.

Returns

bool

true when a compatible entry exists; otherwise, false.

Type Parameters

T

The packet type to query.

Exceptions

ArgumentOutOfRangeException

type is not upgrade or downgrade.

Contains(IMinecraftMessage, TransformationType)

Determines whether a transformation pipeline exists for a message’s runtime type.

bool Contains(IMinecraftMessage message, TransformationType type)

Parameters

message IMinecraftMessage

The message to query.

type TransformationType

The upgrade or downgrade table to query.

Returns

bool

true when a compatible entry exists; otherwise, false.

Exceptions

ArgumentOutOfRangeException

type is not upgrade or downgrade.

Contains(Type, TransformationType)

Determines whether a transformation pipeline exists for a runtime packet type.

bool Contains(Type packetType, TransformationType transformationType)

Parameters

packetType Type

The type to query.

transformationType TransformationType

The upgrade or downgrade table to query.

Returns

bool

true when a compatible entry exists; otherwise, false.

Exceptions

ArgumentOutOfRangeException

transformationType is not upgrade or downgrade.

Replace(IReadOnlyDictionary<IEnumerable<MinecraftPacketTransformationMapping>, Type>, ProtocolVersion)

Clears existing pipelines and selects transformations applicable beyond a protocol version.

IMinecraftPacketTransformationsRegistry Replace(IReadOnlyDictionary<IEnumerable<MinecraftPacketTransformationMapping>, Type> mappings, ProtocolVersion protocolVersion)

Parameters

mappings IReadOnlyDictionary<IEnumerable<MinecraftPacketTransformationMapping>, Type>

Packet types keyed by their transformation mappings.

protocolVersion ProtocolVersion

The current protocol version used to filter mappings.

Returns

IMinecraftPacketTransformationsRegistry

This registry.

Exceptions

ArgumentException

More than one mapping set attempts to register the same packet type.

TryGetFor(Type, TransformationType, out MinecraftPacketTransformation[])

Attempts to get the exact packet type’s ordered transformation pipeline.

bool TryGetFor(Type packetType, TransformationType type, out MinecraftPacketTransformation[] transformation)

Parameters

packetType Type

The exact registered packet type.

type TransformationType

The upgrade or downgrade table to query.

transformation MinecraftPacketTransformation[]

When successful, the ordered transformation array; otherwise, null.

Returns

bool

true when an exact entry exists; otherwise, false.

Exceptions

ArgumentOutOfRangeException

type is not upgrade or downgrade.