Skip to content

Interface IMinecraftBinaryPacketWrapper

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

Provides ordered, typed access to packet properties while a binary packet transformation is running.

public interface IMinecraftBinaryPacketWrapper

Remarks

consumes input without emitting it, appends output, and performs both operations.

Indexed access operates on properties already appended for output and counts occurrences of the requested type rather than absolute field positions.

Methods

Get<TPropertyValue>(int)

Gets an emitted property by its one-based occurrence among properties of the requested type.

TPropertyValue Get<TPropertyValue>(int index) where TPropertyValue : IPacketProperty<TPropertyValue>

Parameters

index int

The one-based occurrence index. The built-in implementation also treats nonpositive values as the first occurrence.

Returns

TPropertyValue

The matching emitted property.

Type Parameters

TPropertyValue

The property type to locate.

Exceptions

InvalidOperationException

No matching property exists.

Passthrough<TPropertyValue>()

Consumes the next input property and appends the same property to output.

TPropertyValue Passthrough<TPropertyValue>() where TPropertyValue : IPacketProperty<TPropertyValue>

Returns

TPropertyValue

The property that was consumed and appended.

Type Parameters

TPropertyValue

The property type to decode.

Read<TPropertyValue>()

Consumes and decodes the next input property without appending it to output.

TPropertyValue Read<TPropertyValue>() where TPropertyValue : IPacketProperty<TPropertyValue>

Returns

TPropertyValue

The consumed property.

Type Parameters

TPropertyValue

The property type to decode.

Reset()

Moves emitted output back into the readable queue in emission order and clears the output list.

void Reset()

Set<TPropertyValue>(int, TPropertyValue)

Replaces an emitted property by occurrence among properties of the same type.

void Set<TPropertyValue>(int index, TPropertyValue value) where TPropertyValue : IPacketProperty<TPropertyValue>

Parameters

index int

The one-based occurrence index. The built-in implementation also treats nonpositive values as the first occurrence.

value TPropertyValue

The replacement property.

Type Parameters

TPropertyValue

The property type to replace.

Exceptions

InvalidOperationException

No matching property exists.

TryGet<TPropertyValue>(int, out TPropertyValue)

Attempts to get an emitted property by its one-based occurrence among properties of the requested type.

bool TryGet<TPropertyValue>(int index, out TPropertyValue value) where TPropertyValue : IPacketProperty<TPropertyValue>

Parameters

index int

The one-based occurrence index. The built-in implementation also treats nonpositive values as the first occurrence.

value TPropertyValue

When this method returns true, the matching property; otherwise, the default value.

Returns

bool

true when a matching emitted property exists; otherwise, false.

Type Parameters

TPropertyValue

The property type to locate.

TrySet<TPropertyValue>(int, TPropertyValue)

Attempts to replace an emitted property by occurrence among properties of the same type.

bool TrySet<TPropertyValue>(int index, TPropertyValue value) where TPropertyValue : IPacketProperty<TPropertyValue>

Parameters

index int

The one-based occurrence index. The built-in implementation also treats nonpositive values as the first occurrence.

value TPropertyValue

The replacement property.

Returns

bool

true when a matching property was replaced; otherwise, false.

Type Parameters

TPropertyValue

The property type to replace.

Write<TPropertyValue>(TPropertyValue)

Appends a property to transformed output without consuming input.

void Write<TPropertyValue>(TPropertyValue value) where TPropertyValue : IPacketProperty<TPropertyValue>

Parameters

value TPropertyValue

The property to append.

Type Parameters

TPropertyValue

The property type.

WriteProcessedValues(ref MinecraftBuffer)

Writes queued processed properties, or copies the underlying message stream when no queued properties remain.

void WriteProcessedValues(ref MinecraftBuffer buffer)

Parameters

buffer MinecraftBuffer

The destination buffer.