Views
Actions
Difference between revisions of "Named Binary Tag/1.18"
(Copy Named Binary Tag to MC1.18 archive) |
(No difference)
|
Latest revision as of 07:45, 10 June 2022
Information between two points are passed in many different ways in Minecraft. The most common of them is known as NBTs. NBTs are a structured binary file used to store information on the disk. They are also used as intermediaries to hold information that will be sent across a network. Understanding and utilizing NBTs properly is a good start to understanding disk storage in general.
NBT Types
There are a total of fourteen different nbt data types that can be parsed. The most common one to use is CompoundTag
s within a BlockEntity
or Entity
when it comes to writing to the disk. However, on capabilities, other types can be specified to reduce the space it takes on a file.
All types implement Tag
in some fashion. This interface holds basic methods for writing to a file and copying itself. It also holds basic methods to determine the output to a chat line.
Id | Name | Description |
---|---|---|
0 | EndTag |
Specifies the end of an nbt file. |
1 | ByteTag |
Holds a byte. Also used to store a boolean value. |
2 | ShortTag |
Holds a short. |
3 | IntTag |
Holds an integer. |
4 | LongTag |
Holds a long. |
5 | FloatTag |
Holds a float. |
6 | DoubleTag |
Holds a double. |
7 | ByteArrayTag |
Holds a byte array. Can be parsed from an array of primitive bytes or a list of byte objects. |
8 | StringTag |
Holds a string. |
9 | ListTag |
Holds a list of a specific Tag .
|
10 | CompoundTag |
Holds an object comprised of Tag s. It works similarly to a java object where it can store other primitives, objects, or itself inside.
|
11 | IntArrayTag |
Holds an integer array. Can be parsed from an array of primitive integers or a list of integer objects. |
12 | LongArrayTag |
Holds an long array. Can be parsed from an array of primitive long, a list of long objects, or a LongSet .
|
99 | NumericTag |
Holds a generic number. Used when the specific Tag for a number is not specified. All numbers can be converted to each other.
|
In most cases, you will only have to deal with CompoundTag
and ListTag
. The others are usually handled internally by whichever type uses them.
Common Usages
CompoundTag
s are used similar to objects. You can put
and value within them using a key. You can then retrieve the value once again with that same key. It has specific methods for putting and getting most of the different types of data (e.g. an integer using putInt
and getInt
).
ListTag
s are functionally the same as ArrayList
s. You can add
, remove
, set
, or get
a specific NBT type.