public enum NBT extends Enum<NBT>
A bunch of NBT tools.
Note: For all the exceptions, see the "invoke" methods of NBTLib
.
Enum Constant and Description |
---|
BOOL |
BYTE |
BYTE_ARRAY |
COMPOUND |
DOUBLE |
END |
FLOAT |
INT |
INT_ARRAY |
LIST |
LONG |
SHORT |
STRING |
Modifier and Type | Method and Description |
---|---|
static Object |
bukkitToMc(ItemStack item)
Converts a Bukkit ItemStack into a Minecraft ItemStack.
|
static NBT |
getEnum(Object o)
Returns an
NBT representing the type of a Minecraft NBTBase object. |
int |
getId()
Returns the ID of the NBT Tag represented by this enum constant.
|
static Map<String,Tag> |
itemStackToMap(ItemStack item)
|
static ItemStack |
loadItemStack(byte[] array)
Loads a Bukkit ItemStack from an array of bytes (using NBT).
|
static ItemStack |
loadItemStack(DataInput input)
Loads a Bukkit ItemStack from a
DataInput object (using NBT). |
static ItemStack |
loadItemStack(InputStream stream)
Loads a Bukkit ItemStack from an
InputStream (using NBT). |
static ItemStack |
loadItemStack64(String string)
Loads a Bukkit ItemStack from a base64 encoded string (using NBT).
|
static Object |
loadNBT(byte[] array)
Loads an NBTTagCompound from an array of bytes.
|
static Object |
loadNBT(DataInput input)
Loads an NBTTagCompound from a
DataInput object. |
static Object |
loadNBT(InputStream stream)
Loads an NBTTagCompound from an
InputStream . |
static Object |
loadNBT64(String string)
Loads an NBTTagCompound from a base64 encoded string.
|
static ItemStack |
mapToItemStack(Map<String,?> map)
|
static Object |
mapToNBT(Map<String,?> map)
Converts a
Map into an NBTTagCompound. |
static Object |
mapToNBT(String name,
Map<String,?> map)
Deprecated.
|
static ItemStack |
mcToBukkit(Object o)
Converts a Minecraft ItemStack into a Bukkit ItemStack.
|
static Map<String,Tag> |
NBTToMap(Object o)
Converts an NBTTagCompound into a
Map . |
static Tag |
NBTToTag(Object o)
Converts an NBTTagCompound into a
Tag . |
static void |
saveItemStack(DataOutput output,
ItemStack item)
Saves a Bukkit ItemStack to a
DataOutput object (using NBT). |
static byte[] |
saveItemStack(ItemStack item)
Saves a Bukkit ItemStack to an array of bytes (using NBT).
|
static void |
saveItemStack(OutputStream stream,
ItemStack item)
Saves a Bukkit ItemStack to an
OutputStream (using NBT). |
static String |
saveItemStack64(ItemStack item)
Saves a Bukkit ItemStack to a base64 encoded string (using NBT).
|
static void |
saveNBT(DataOutput output,
Object o)
Saves an NBTTagCompound to a
DataInput object. |
static byte[] |
saveNBT(Object o)
Loads an NBTTagCompound from an array of bytes.
|
static void |
saveNBT(OutputStream stream,
Object o)
Saves an NBTTagCompound to an
InputStream . |
static String |
saveNBT64(Object o)
Saves an NBTTagCompound to a base64 encoded string.
|
static Object |
tagToNBT(String name,
Tag tag)
Deprecated.
|
static Object |
tagToNBT(Tag tag)
Converts a
Tag into an NBTTagCompound. |
static NBT |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static NBT[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final NBT BOOL
public static final NBT END
public static final NBT BYTE
public static final NBT SHORT
public static final NBT INT
public static final NBT LONG
public static final NBT FLOAT
public static final NBT DOUBLE
public static final NBT BYTE_ARRAY
public static final NBT STRING
public static final NBT LIST
public static final NBT COMPOUND
public static final NBT INT_ARRAY
public static NBT[] values()
for (NBT c : NBT.values()) System.out.println(c);
public static NBT valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant
with the specified nameNullPointerException
- if the argument is nullpublic int getId()
Returns the ID of the NBT Tag represented by this enum constant.
public static Map<String,Tag> itemStackToMap(ItemStack item) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchFieldException, NoSuchMethodException, NBTLibDisabledException, UnknownTagException
item
- The ItemStack.ClassNotFoundException
IllegalAccessException
InstantiationException
InvocationTargetException
NoSuchFieldException
NoSuchMethodException
NBTLibDisabledException
UnknownTagException
public static ItemStack mapToItemStack(Map<String,?> map) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchFieldException, NoSuchMethodException, NBTLibDisabledException, UnknownTagException
map
- The Map.ClassNotFoundException
IllegalAccessException
InstantiationException
InvocationTargetException
NoSuchFieldException
NoSuchMethodException
NBTLibDisabledException
UnknownTagException
@Deprecated public static Object mapToNBT(String name, Map<String,?> map) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchFieldException, NoSuchMethodException, NBTLibDisabledException, UnknownTagException
Converts a Map
into an NBTTagCompound.
name
- The name of the tag.map
- The map.ClassNotFoundException
IllegalAccessException
InstantiationException
InvocationTargetException
NoSuchFieldException
NoSuchMethodException
NBTLibDisabledException
UnknownTagException
public static Object mapToNBT(Map<String,?> map) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchFieldException, NoSuchMethodException, NBTLibDisabledException, UnknownTagException
Converts a Map
into an NBTTagCompound.
map
- The map.ClassNotFoundException
IllegalAccessException
InstantiationException
InvocationTargetException
NoSuchFieldException
NoSuchMethodException
NBTLibDisabledException
UnknownTagException
@Deprecated public static Object tagToNBT(String name, Tag tag) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException, NBTLibDisabledException
Deprecated.
Converts a Tag
into an NBTTagCompound.
name
- The name of the tag.tag
- The Tag.ClassNotFoundException
IllegalAccessException
InstantiationException
InvocationTargetException
NoSuchMethodException
NBTLibDisabledException
public static Object tagToNBT(Tag tag) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException, NBTLibDisabledException
Converts a Tag
into an NBTTagCompound.
tag
- The Tag.ClassNotFoundException
IllegalAccessException
InstantiationException
InvocationTargetException
NoSuchMethodException
NBTLibDisabledException
public static Map<String,Tag> NBTToMap(Object o) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchFieldException, NoSuchMethodException, NBTLibDisabledException, UnknownTagException
Converts an NBTTagCompound into a Map
.
o
- The NBTTagCompound.ClassNotFoundException
IllegalAccessException
InvocationTargetException
NoSuchFieldException
NoSuchMethodException
NBTLibDisabledException
UnknownTagException
public static Tag NBTToTag(Object o) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchFieldException, NoSuchMethodException, NBTLibDisabledException, UnknownTagException
Converts an NBTTagCompound into a Tag
.
o
- The NBTTagCompound.ClassNotFoundException
IllegalAccessException
InvocationTargetException
NoSuchFieldException
NoSuchMethodException
NBTLibDisabledException
UnknownTagException
public static Object loadNBT64(String string) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NBTLibDisabledException
Loads an NBTTagCompound from a base64 encoded string.
string
- A base64 encoded string.ClassNotFoundException
IllegalAccessException
InvocationTargetException
NoSuchMethodException
NBTLibDisabledException
public static Object loadNBT(byte[] array) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NBTLibDisabledException
Loads an NBTTagCompound from an array of bytes.
array
- An array of bytes.ClassNotFoundException
IllegalAccessException
InvocationTargetException
NoSuchMethodException
NBTLibDisabledException
public static Object loadNBT(InputStream stream) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NBTLibDisabledException
Loads an NBTTagCompound from an InputStream
.
stream
- An InputStream
.ClassNotFoundException
IllegalAccessException
InvocationTargetException
NoSuchMethodException
NBTLibDisabledException
public static Object loadNBT(DataInput input) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NBTLibDisabledException
Loads an NBTTagCompound from a DataInput
object.
input
- A DataInput
object.ClassNotFoundException
IllegalAccessException
InvocationTargetException
NoSuchMethodException
NBTLibDisabledException
public static String saveNBT64(Object o) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NBTLibDisabledException
Saves an NBTTagCompound to a base64 encoded string.
o
- An NBTTagCompound.ClassNotFoundException
IllegalAccessException
InvocationTargetException
NoSuchMethodException
NBTLibDisabledException
public static byte[] saveNBT(Object o) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NBTLibDisabledException
Loads an NBTTagCompound from an array of bytes.
o
- An NBTTagCompound.ClassNotFoundException
IllegalAccessException
InvocationTargetException
NoSuchMethodException
NBTLibDisabledException
public static void saveNBT(OutputStream stream, Object o) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NBTLibDisabledException
Saves an NBTTagCompound to an InputStream
.
stream
- An InputStream
.o
- An NBTTagCompound.ClassNotFoundException
IllegalAccessException
InvocationTargetException
NoSuchMethodException
NBTLibDisabledException
public static void saveNBT(DataOutput output, Object o) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NBTLibDisabledException
Saves an NBTTagCompound to a DataInput
object.
output
- A DataInput
object.o
- An NBTTagCompound.ClassNotFoundException
IllegalAccessException
InvocationTargetException
NoSuchMethodException
NBTLibDisabledException
public static ItemStack loadItemStack64(String string) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NBTLibDisabledException
Loads a Bukkit ItemStack from a base64 encoded string (using NBT).
string
- A base64 encoded string.ItemStack
.ClassNotFoundException
IllegalAccessException
InvocationTargetException
NoSuchMethodException
NBTLibDisabledException
public static ItemStack loadItemStack(byte[] array) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NBTLibDisabledException
Loads a Bukkit ItemStack from an array of bytes (using NBT).
array
- An array of bytes.ItemStack
.ClassNotFoundException
IllegalAccessException
InvocationTargetException
NoSuchMethodException
NBTLibDisabledException
public static ItemStack loadItemStack(InputStream stream) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NBTLibDisabledException
Loads a Bukkit ItemStack from an InputStream
(using NBT).
stream
- An InputStream
.ItemStack
.ClassNotFoundException
IllegalAccessException
InvocationTargetException
NoSuchMethodException
NBTLibDisabledException
public static ItemStack loadItemStack(DataInput input) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NBTLibDisabledException
Loads a Bukkit ItemStack from a DataInput
object (using NBT).
input
- A DataInput
object.ItemStack
.ClassNotFoundException
IllegalAccessException
InvocationTargetException
NoSuchMethodException
NBTLibDisabledException
public static String saveItemStack64(ItemStack item) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException, NBTLibDisabledException
Saves a Bukkit ItemStack to a base64 encoded string (using NBT).
item
- A bukkit ItemStack
.ClassNotFoundException
IllegalAccessException
InstantiationException
InvocationTargetException
NoSuchMethodException
NBTLibDisabledException
public static byte[] saveItemStack(ItemStack item) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException, NBTLibDisabledException
Saves a Bukkit ItemStack to an array of bytes (using NBT).
item
- A bukkit ItemStack
.ClassNotFoundException
IllegalAccessException
InstantiationException
InvocationTargetException
NoSuchMethodException
NBTLibDisabledException
public static void saveItemStack(OutputStream stream, ItemStack item) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException, NBTLibDisabledException
Saves a Bukkit ItemStack to an OutputStream
(using NBT).
stream
- An OutputStream
.item
- A bukkit ItemStack
.ClassNotFoundException
IllegalAccessException
InstantiationException
InvocationTargetException
NoSuchMethodException
NBTLibDisabledException
public static void saveItemStack(DataOutput output, ItemStack item) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException, NBTLibDisabledException
Saves a Bukkit ItemStack to a DataOutput
object (using NBT).
output
- A DataOutput
object.item
- A bukkit ItemStack
.ClassNotFoundException
IllegalAccessException
InstantiationException
InvocationTargetException
NoSuchMethodException
NBTLibDisabledException
public static Object bukkitToMc(ItemStack item) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NBTLibDisabledException
Converts a Bukkit ItemStack into a Minecraft ItemStack.
item
- The Bukkit ItemStack
.ClassNotFoundException
IllegalAccessException
InvocationTargetException
NoSuchMethodException
NBTLibDisabledException
public static ItemStack mcToBukkit(Object o) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NBTLibDisabledException
Converts a Minecraft ItemStack into a Bukkit ItemStack.
o
- The Minecraft ItemStack.ItemStack
.ClassNotFoundException
IllegalAccessException
InvocationTargetException
NoSuchMethodException
NBTLibDisabledException
public static NBT getEnum(Object o) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NBTLibDisabledException
Returns an NBT
representing the type of a Minecraft NBTBase object.
o
- The Minecraft ItemStack.ClassNotFoundException
IllegalAccessException
InvocationTargetException
NoSuchMethodException
NBTLibDisabledException
Copyright © 2013. All Rights Reserved.