Skip to content

Class NbtTagNumberAdapter

Namespace: Void.Minecraft.Nbt.Serializers.Json.Adapter
Assembly: Void.Minecraft.dll

Selects and aligns NBT numeric types for untyped JSON numbers.

public class NbtTagNumberAdapter

Inheritance

object ← NbtTagNumberAdapter

Inherited Members

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

Methods

AlignNumbers(List<NbtTag>)

Promotes numeric tags in a list to the widest numeric already present in that list.

public static void AlignNumbers(List<NbtTag> tags)

Parameters

tags List<NbtTag>

The list whose numeric entries should be aligned before validating the list element type.

Remarks

This method mutates tags in place by replacing narrower numeric tags with new tags of the target type. Non-numeric tags are left unchanged.

Exceptions

ArgumentNullException

Thrown when tags is null.

InvalidOperationException

Thrown when tags is empty.

DeserializeNumber(ref Utf8JsonReader)

Reads the current JSON number into the narrowest supported NBT numeric type.

public static NbtTag DeserializeNumber(ref Utf8JsonReader reader)

Parameters

reader Utf8JsonReader

The reader positioned on a number.

Returns

NbtTag

An NBT byte, short, integer, long, float, or double tag.

Exceptions

JsonException

The token cannot be represented by an NBT numeric type.