Package com.sk89q.jnbt
Class NBTUtils
java.lang.Object
com.sk89q.jnbt.NBTUtils
A class which contains NBT-related utility methods.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Tag>
TGet child tag of a NBT structure.getTypeClass
(int type) Gets the class of a type of tag.static int
getTypeCode
(Class<? extends Tag> clazz) Gets the type code of a tag class.static String
getTypeName
(Class<? extends Tag> clazz) Gets the type name of a tag.static Vector3
Read a vector from a list tag containing ideally three values: the X, Y, and Z components.
-
Method Details
-
getTypeName
Gets the type name of a tag.- Parameters:
clazz
- the tag class- Returns:
- The type name.
-
getTypeCode
Gets the type code of a tag class.- Parameters:
clazz
- the tag class- Returns:
- The type code.
- Throws:
IllegalArgumentException
- if the tag class is invalid.
-
getTypeClass
Gets the class of a type of tag.- Parameters:
type
- the type- Returns:
- The class.
- Throws:
IllegalArgumentException
- if the tag type is invalid.
-
toVector
Read a vector from a list tag containing ideally three values: the X, Y, and Z components.For values that are unavailable, their values will be 0.
- Parameters:
listTag
- the list tag- Returns:
- a vector
-
getChildTag
public static <T extends Tag> T getChildTag(Map<String, Tag> items, String key, Class<T> expected) throws InvalidFormatExceptionGet child tag of a NBT structure.- Parameters:
items
- the map to read fromkey
- the key to look forexpected
- the expected NBT class type- Returns:
- child tag
- Throws:
InvalidFormatException
- if the format of the items is invalid
-