Skip to content

Class OptionalProperty<TPacketProperty>

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

Represents a Boolean-presence-prefixed optional packet property.

public record OptionalProperty<TPacketProperty> : IPacketProperty<OptionalProperty<TPacketProperty>>, IPacketProperty, IEquatable<OptionalProperty<TPacketProperty>> where TPacketProperty : class, IPacketProperty<TPacketProperty>

Type Parameters

TPacketProperty

The reference-type property decoded when the value is present.

Inheritance

objectOptionalProperty<TPacketProperty>

Implements

IPacketProperty<OptionalProperty<TPacketProperty>>, IPacketProperty, IEquatable<OptionalProperty<TPacketProperty>>

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Constructors

OptionalProperty(TPacketProperty?)

Represents a Boolean-presence-prefixed optional packet property.

public OptionalProperty(TPacketProperty? Value = null)

Parameters

Value TPacketProperty?

The optional value, or null for an absent property.

Properties

Value

The optional value, or null for an absent property.

public TPacketProperty? Value { get; init; }

Property Value

TPacketProperty?

Methods

Read(ref MinecraftBuffer)

Reads the presence flag and, when set, one property value.

public static OptionalProperty<TPacketProperty> Read(ref MinecraftBuffer buffer)

Parameters

buffer MinecraftBuffer

The source buffer.

Returns

OptionalProperty<TPacketProperty>

An optional property containing the decoded value or null.

Write(ref MinecraftBuffer)

Writes a presence flag and writes only when it is non-null.

public void Write(ref MinecraftBuffer buffer)

Parameters

buffer MinecraftBuffer

The destination buffer.