Skip to content

Class NamedNbtProperty

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

Represents a named binary NBT packet property.

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

Inheritance

objectNamedNbtProperty

Implements

IPacketProperty<NamedNbtProperty>, IPacketProperty, IEquatable<NamedNbtProperty>

Inherited Members

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

Constructors

NamedNbtProperty(ReadOnlyMemory<byte>)

Represents a named binary NBT packet property.

public NamedNbtProperty(ReadOnlyMemory<byte> Value)

Parameters

Value ReadOnlyMemory<byte>

The encoded named NBT bytes, retained without copying or validation.

Properties

AsNbtTag

Gets a newly parsed NBT tag from the encoded bytes, including its root name.

public NbtTag AsNbtTag { get; }

Property Value

NbtTag

Value

The encoded named NBT bytes, retained without copying or validation.

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

Property Value

ReadOnlyMemory<byte>

Methods

FromNbtTag(NbtTag)

Serializes a tag with its root name.

public static NamedNbtProperty FromNbtTag(NbtTag value)

Parameters

value NbtTag

The tag to serialize.

Returns

NamedNbtProperty

A property backed by the serialized bytes.

Remarks

If value has a null name, this method mutates it by assigning an empty name before serialization.

Read(ref MinecraftBuffer)

Reads one named NBT tag and stores its normalized binary representation.

public static NamedNbtProperty Read(ref MinecraftBuffer buffer)

Parameters

buffer MinecraftBuffer

The source buffer.

Returns

NamedNbtProperty

The decoded property.

Write(ref MinecraftBuffer)

Parses and writes the NBT value with its root name.

public void Write(ref MinecraftBuffer buffer)

Parameters

buffer MinecraftBuffer

The destination buffer.