nbtd.INBTItem



enum NBTType: ubyte;
Enum for all NBT Types.

End


Byte


Short


Int


Long


Float


Double


ByteArray


String


List


Compound


IntArray


interface INBTItem;
Interface for all NBT TAGs containing convertion functions and virtual functions for type, size, name, value, encoding, decoding and reading from a stream.

abstract @property NBTType type();
Returns:
the type of the NBT Item.

abstract @property int size();
Returns:
the size in bytes of the NBT Item without name.length, name or TAG ID.

abstract @property string name();
Returns:
the name of the Item as UTF-8 string.

abstract @property void name(string name);
Sets the name of the Item as UTF-8 string.

@property T value(T)();
Returns:
the current value as specified in the child classes.

@property void value(T)(T value);
Sets the current value and possible checks the input in the child classes.

abstract ubyte[] encode(bool compressed = true, bool hasName = true);
Encodes the item to a ubyte[] that can be compressed and/or written without name and TAG ID.

Params:
bool compressed When true, the resulting ubyte[] will be GZip compressed.
bool hasName When false, name and TAG ID will be omitted.

abstract void decode(ubyte[] data, bool compressed = true, bool hasName = true);
Decodes the item from a ubyte[] that can be compressed and/or read without name and TAG ID and stores the results in
this
.

Params:
bool compressed When true, the ubyte[] will get uncompressed for decoding.
bool hasName When false, reading won't try to read a name and
this.name
will be set to
""
.

abstract void read(ref ubyte[] stream, bool hasName = true);
Decodes the item from a ubyte[] stream that can be read without name and TAG ID and stores the results in
this
and advances the stream.

Params:
bool hasName When false, reading won't try to read a name and
this.name
will be set to
""
.

abstract @property INBTItem dup();
Duplicates the Item.

final NBTByte asByte();
Will check if the type is
NBTType.Byte
and return
this
as
NBTByte


final NBTShort asShort();
Will check if the type is
NBTType.Short
and return
this
as
NBTShort


final NBTInt asInt();
Will check if the type is
NBTType.Int
and return
this
as
NBTInt


final NBTLong asLong();
Will check if the type is
NBTType.Long
and return
this
as
NBTLong


final NBTFloat asFloat();
Will check if the type is
NBTType.Float
and return
this
as
NBTFloat


final NBTDouble asDouble();
Will check if the type is
NBTType.Double
and return
this
as
NBTDouble


final NBTByteArray asByteArray();
Will check if the type is
NBTType.ByteArray
and return
this
as
NBTByteArray


final NBTString asString();
Will check if the type is
NBTType.String
and return
this
as
NBTString


final NBTList asList();
Will check if the type is
NBTType.List
and return
this
as
NBTList


final NBTCompound asCompound();
Will check if the type is
NBTType.Compound
and return
this
as
NBTCompound


final NBTIntArray asIntArray();
Will check if the type is
NBTType.IntArray
and return
this
as
NBTIntArray



Page generated by Ddoc.