Skip to content

Class VarIntProperty

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

Represents a Minecraft variable-length signed 32-bit packet property.

public record VarIntProperty : IPacketProperty<VarIntProperty>, IPacketProperty, IEquatable<VarIntProperty>

Inheritance

objectVarIntProperty

Implements

IPacketProperty<VarIntProperty>, IPacketProperty, IEquatable<VarIntProperty>

Inherited Members

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

Constructors

VarIntProperty(ReadOnlyMemory<byte>)

Represents a Minecraft variable-length signed 32-bit packet property.

public VarIntProperty(ReadOnlyMemory<byte> Value)

Parameters

Value ReadOnlyMemory<byte>

The encoded property bytes, retained without copying or validation.

Properties

AsPrimitive

Gets the signed 32-bit value decoded from the variable-length bytes.

public int AsPrimitive { get; }

Property Value

int

Value

The encoded property bytes, retained without copying or validation.

public ReadOnlyMemory<byte> Value { get; init; }

Property Value

ReadOnlyMemory<byte>

Methods

FromPrimitive(int)

Encodes a signed 32-bit integer using Minecraft variable-length encoding.

public static VarIntProperty FromPrimitive(int value)

Parameters

value int

The value to encode.

Returns

VarIntProperty

The encoded property.

Read(ref MinecraftBuffer)

Reads one variable-length signed 32-bit integer from a buffer.

public static VarIntProperty Read(ref MinecraftBuffer buffer)

Parameters

buffer MinecraftBuffer

The source buffer.

Returns

VarIntProperty

The decoded property.

Exceptions

InvalidOperationException

The encoding uses more than five bytes.

Write(ref MinecraftBuffer)

Writes the decoded value using Minecraft variable-length encoding.

public void Write(ref MinecraftBuffer buffer)

Parameters

buffer MinecraftBuffer

The destination buffer.