Lucky Block Documentation

Contents

4. NBT Tags


NBT Tags are a structural value used to store complex properties and data regarding items, blocks (tile entities) and entities. NBT Tags have previously been used in many examples, such as giving items enchantments, storing items in chests and giving equipment to entities. They are mainly used with the tileEntity property for blocks and NBTTag property for items and entities. The Lucky Block uses an NBT format similar to the format in Minecraft commands, though the key differences include using normal brackets ( instead of curly brackets {, and using an equals sign = instead of a colon :. The Lucky Block system also allows for a more detailed specification of data types.

 

Tag Name Format Example Description
TAG_STRING name="value" Name="Special Item"

Used to specify a text tag. The example is used to give items custom names.

TAG_INT name=integer lvl=3

Used to specify an integer tag. The example is used for enchantment levels.

TAG_BOOLEAN name=true/false sparkle=true

Used to specify a tag that is either true or false. The example is used for fireworks properties.

TAG_FLOAT name=floatF size=3.29F

Used to specify a decimal number tag. Note that without the F, the tag will either become a double tag (if a decimal point is present) or an integer tag. In NBT Tags, float and double can generally be used interchangeably, but integers cannot. Therefore, is is crucial that all decimal values contain either a decimal point, F or D.

TAG_DOUBLE name=floatD OR
name=float.xxx
side=2.0 OR size=2D

Used to specify a decimal number tag. Apart from storage capacity, this is identical to a float, and it is generally not relevant whether a double tag or float tag is used.

TAG_BYTE
TAG_SHORT
TAG_LONG
name=integerB
name=integerS
name=integerL
length=8B
length=52S
length=2876439L

Used to specify number tags, incrementing in size. Similarly to doubles and floats, an integer tag may be used instead of these tags. However, if these tags are used, the values must not exceed the size respective size limits.

TAG_INT_ARRAY name=integer : integer : integer : ... nums=372:35:97

Used to specify an integer array tag. The tag contains a list of numbers, separated by colons. If only one element is present, use name=integer:. Note that a tag list (see below) containing integers can often be used instead.

TAG_BYTE_ARRAY name=integerB : integerB : integerB : ... nums=6B:4B:8B

Used to specify a number array tag. The tag contains a list of small numbers, separated by colons. Note an integer array or a tag list (see below) containing bytes or integers can generally be used instead.

TAG_COMPOUND name=(name=value,name=value...) tag=(Id="diamond_sword",
Count=2)

Used to specify a tag contains more tags within it. The tags inside can be of any type, including tag compounds. This allows for complex tag structures. Note that all NBT Tags begin with a tag compound (NBTTag=(...), tileEntity=(...)). The example may be used in chests or entity equipment.

TAG_LIST name=[value,value...] Motion=[2.5,1.9,3.0]

Used to specify a tag that contains the values of tags within it. This is very similar to a tag compound, except the inner tags only contain values, without names. Also, all of the inner values must be of the same type. In the example, and entity's motion is specified with double tags.

 

Examples


type=item,ID=diamond,NBTTag=(display=(Name="Lucky Diamond")

This NBT Tag is used to configure the custom display name of an item. It contains a compound tag for specifying display properties. Within the display tag compound, it contains a text tag specifying the custom name.

NBTTag=(title="Lucky Block Book",author="Player In Distress",pages=["Hope you're enjoying","configuring custom","books!"])

This NBT Tag is used to configure a custom book. It contains two text tags, specifying the title and author, and a tag list. The tag list contains text tags used for specifying the test of the pages.

NBTTag=(Equipment=[(id=fishing_rod),(id=iron_boots),(id=chainmail_leggings),
(id=leather_chestplate,tag=(display=(color=8339378))),(id=pumpkin)])

This NBT Tag is used to configure the equipment of an entity. It contains a list tag for specifying equipment. Within the equipment list tag are five compound tags, one for each equipment item. Within each item tag is a text tag specifying the ID of the item. Additionally, the leather chestplate tag contains a compound tag specifying display properties. Within the display compound tag is an integer tag specifying the color. NBT Tags can be used to specify a large amount of properties, as demonstrated by this example.

Back Forward

Copyright Minecraft Ascending 2015