Skip to content

Class IntProperty

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

Represents the encoded payload of a fixed-width integer packet property.

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

Inheritance

objectIntProperty

Implements

IPacketProperty<IntProperty>, IPacketProperty, IEquatable<IntProperty>

Inherited Members

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

Remarks

The supplied memory is stored without validation. It must contain at least four bytes before the value is decoded or written.

Constructors

IntProperty(ReadOnlyMemory<byte>)

Represents the encoded payload of a fixed-width integer packet property.

public IntProperty(ReadOnlyMemory<byte> Value)

Parameters

Value ReadOnlyMemory<byte>

The bytes containing the big-endian Minecraft binary representation of the integer.

Remarks

The supplied memory is stored without validation. It must contain at least four bytes before the value is decoded or written.

Properties

AsPrimitive

Gets the signed 32-bit value decoded from the property bytes.

public int AsPrimitive { get; }

Property Value

int

Value

The bytes containing the big-endian Minecraft binary representation of the integer.

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

Property Value

ReadOnlyMemory<byte>

Methods

FromPrimitive(int)

Encodes a signed 32-bit integer as four big-endian bytes.

public static IntProperty FromPrimitive(int value)

Parameters

value int

The value to encode.

Returns

IntProperty

The encoded property.

Read(ref MinecraftBuffer)

Reads one big-endian signed 32-bit integer from a buffer.

public static IntProperty Read(ref MinecraftBuffer buffer)

Parameters

buffer MinecraftBuffer

The source buffer.

Returns

IntProperty

The decoded property.

Write(ref MinecraftBuffer)

Writes the decoded signed 32-bit integer in big-endian order.

public void Write(ref MinecraftBuffer buffer)

Parameters

buffer MinecraftBuffer

The destination buffer.