Skip to content

Class ShortTag

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

A tag that contains a single 16-bit integer value.

public class ShortTag : NumericTag<short>, IEquatable<Tag>, ICloneable, IEquatable<NumericTag<short>>, IComparable<NumericTag<short>>, IComparable

Inheritance

objectTagNumericTag<short>ShortTag

Implements

IEquatable<Tag>, ICloneable, IEquatable<NumericTag<short>>, IComparable<NumericTag<short>>, IComparable

Inherited Members

NumericTag<short>.Value, NumericTag<short>.Equals(NumericTag<short>?), NumericTag<short>.Equals(object?), NumericTag<short>.GetHashCode(), NumericTag<short>.CompareTo(NumericTag<short>?), NumericTag<short>.CompareTo(object?), Tag.NoName, Tag.Type, Tag.Parent, Tag.Name, Tag.PrettyPrinted(StringBuilder, int, string), Tag.PrettyName, Tag.WriteJson(Utf8JsonWriter, bool), Tag.WriteJson(Stream, JsonWriterOptions?), Tag.WriteJsonAsync(Stream, JsonWriterOptions?), Tag.ToJson(JsonWriterOptions?), Tag.ToJsonString(bool, string), Tag.Equals(Tag?), Tag.Equals(object?), Tag.GetHashCode(), Tag.Clone(), Tag.Stringify(bool), Tag.StringifyName, object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Constructors

ShortTag(string?, short)

Creates a new instance of the class with the specified value.

public ShortTag(string? name, short value)

Parameters

name string?

The name of the tag, or null if tag has no name.

value short

The value to assign to this tag.

ShortTag(string?, int)

Creates a new instance of the class with the specified value.

public ShortTag(string? name, int value)

Parameters

name string?

The name of the tag, or null if tag has no name.

value int

The value to assign to this tag.

Remarks

The use of is for convenience only.

ShortTag(string?, ushort)

Creates a new instance of the class with the specified value.

public ShortTag(string? name, ushort value)

Parameters

name string?

The name of the tag, or null if tag has no name.

value ushort

The value to assign to this tag.

Properties

UnsignedValue

Gets or sets the value of this tag as an unsigned value.

public ushort UnsignedValue { get; set; }

Property Value

ushort

Remarks

This is only a reinterpretation of the bytes, no actual conversion is performed.

Methods

Stringify(bool)

Gets the string representation of this NBT tag (SNBT).

public override string Stringify(bool named = true)

Parameters

named bool

Flag indicating if the name of the tag should be written.

Returns

string

This NBT tag in SNBT format.

See Also

https://minecraft.fandom.com/wiki/NBT_format#SNBT_format

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

WriteJson(Utf8JsonWriter, bool)

Uses the provided writer to write the NBT tag in JSON format.

protected override void WriteJson(Utf8JsonWriter writer, bool named = true)

Parameters

writer Utf8JsonWriter

A JSON writer instance.

named bool

Flag indicating if this object’s name should be written as a property name, or false when it is a child of , in which case it should be written as a JSON array element.

Operators

implicit operator short(ShortTag)

Implicit conversion of this tag to a .

public static implicit operator short(ShortTag tag)

Parameters

tag ShortTag

The tag to convert.

Returns

short

The tag represented as a .

implicit operator ushort(ShortTag)

Implicit conversion of this tag to a .

public static implicit operator ushort(ShortTag tag)

Parameters

tag ShortTag

The tag to convert.

Returns

ushort

The tag represented as a .