Skip to content

Class NbtReader

Namespace: Void.Minecraft.Nbt
Assembly: Void.Minecraft.dll

Reads binary NBT while preserving empty compound keys and supporting unnamed roots.

public class NbtReader : TagReader, IDisposable

Inheritance

objectTagIOTagReaderNbtReader

Implements

IDisposable

Inherited Members

TagReader.TagRead, TagReader.TagEncountered, TagReader.ReadByte(bool), TagReader.ReadShort(bool), TagReader.ReadInt(bool), TagReader.ReadLong(bool), TagReader.ReadFloat(bool), TagReader.ReadDouble(bool), TagReader.ReadString(bool), TagReader.ReadByteArray(bool), TagReader.ReadIntArray(bool), TagReader.ReadLongArray(bool), TagReader.ReadList(bool), TagReader.ReadCompound(bool), TagReader.ReadTag(bool), TagReader.ReadTagAsync(bool), TagReader.ReadTag<T>(bool), TagReader.ReadTagAsync<T>(bool), TagReader.ReadUTF8String(), TagReader.ReadToFixSizedBuffer(Span<byte>), TagReader.ReadToFixSizedBuffer(byte[], int, int), TagReader.Dispose(), TagReader.DisposeAsync(), TagReader.OnTagRead(Tag), TagReader.OnTagEncountered(TagType, bool), TagIO.BaseStream, TagIO.SwapEndian, TagIO.UseVarInt, TagIO.ZigZagEncoding, TagIO.FormatOptions, TagIO.Dispose(), TagIO.DisposeAsync(), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Constructors

NbtReader(Stream, FormatOptions, bool)

Reads binary NBT while preserving empty compound keys and supporting unnamed roots.

public NbtReader(Stream stream, FormatOptions options, bool leaveOpen = false)

Parameters

stream Stream

The source stream.

options FormatOptions

The binary NBT encoding options.

leaveOpen bool

Whether to leave stream open when the reader is disposed.

Methods

ReadCompound(bool)

Reads a compound payload through its terminating end tag.

public CompoundTag ReadCompound(bool named = true)

Parameters

named bool

Whether to read the compound’s name before its payload.

Returns

CompoundTag

The compound, including children with empty names preserved as empty strings.

ReadList(bool)

Reads a homogeneous list payload.

public ListTag ReadList(bool named = true)

Parameters

named bool

Whether to read the list’s name before its payload.

Returns

ListTag

The parsed list.

Exceptions

FormatException

A non-empty list declares as its child type.

ReadTag(bool)

Reads a tag type identifier followed by its optional name and payload.

public Tag ReadTag(bool named = true)

Parameters

named bool

Whether the tag includes a name field.

Returns

Tag

The parsed tag.