public class NBTHelper
extends java.lang.Object
Constructor and Description |
---|
NBTHelper() |
Modifier and Type | Method and Description |
---|---|
static void |
addInfo(net.minecraft.item.ItemStack itemStack,
java.util.List<java.lang.String> text)
Appends an item description to the stack
|
static boolean |
getBoolean(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName)
Gets a value for the given key from the passed ItemStack
|
static byte |
getByte(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName)
Gets a value for the given key from the passed ItemStack
|
static net.minecraft.nbt.NBTTagCompound |
getCompoundTag(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName)
Gets a compound tag for the provided key in the passed ItemStack
|
static double |
getDouble(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName)
Gets a value for the given key from the passed ItemStack
|
static float |
getFloat(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName)
Gets a value for the given key from the passed ItemStack
|
static int |
getInt(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName)
Gets a value for the given key from the passed ItemStack
|
static int[] |
getIntArray(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName)
Gets a value for the given key from the passed ItemStack
|
static net.minecraft.nbt.NBTTagList |
getList(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName,
int type)
Gets the
NBTTagList for the provided key in the passed ItemStack |
static long |
getLong(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName)
Gets a value for the given key from the passed ItemStack
|
static short |
getShort(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName)
Gets a value for the given key from the passed ItemStack
|
static java.lang.String |
getString(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName)
Gets a value for the given key from the passed ItemStack
|
static net.minecraft.nbt.NBTBase |
getTag(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName)
Gets a tag for the provided key in the passed ItemStack
|
static boolean |
hasTag(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName)
Checks if the passed ItemStack contains the given tag in its NBTData
|
static void |
removeInfo(net.minecraft.item.ItemStack itemStack)
Removes the item description to the stack
|
static void |
removeTag(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName)
Removes the specified tag from the stack's NBTData
|
static void |
setBoolean(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName,
boolean keyValue)
Sets the value of the provided key on the passed ItemStack
|
static void |
setByte(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName,
byte keyValue)
Sets the value of the provided key on the passed ItemStack
|
static void |
setCompoundTag(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName,
net.minecraft.nbt.NBTTagCompound tag)
Sets a compound tag for the provided key in the passed ItemStack
|
static void |
setDouble(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName,
double keyValue)
Sets the value of the provided key on the passed ItemStack
|
static void |
setFloat(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName,
float keyValue)
Sets the value of the provided key on the passed ItemStack
|
static void |
setInfo(net.minecraft.item.ItemStack itemStack,
java.util.List<java.lang.String> text)
Sets an item description to the stack
|
static void |
setIntArray(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName,
int[] array)
Sets the value of the provided key on the passed ItemStack
|
static void |
setInteger(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName,
int keyValue)
Sets the value of the provided key on the passed ItemStack
|
static void |
setList(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName,
net.minecraft.nbt.NBTTagList tag)
Sets the
NBTTagList for the provided key in the passed ItemStack |
static void |
setLong(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName,
long keyValue)
Sets the value of the provided key on the passed ItemStack
|
static void |
setShort(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName,
short keyValue)
Sets the value of the provided key on the passed ItemStack
|
static void |
setString(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName,
java.lang.String keyValue)
Sets the value of the provided key on the passed ItemStack
|
static void |
setTag(net.minecraft.item.ItemStack itemStack,
java.lang.String keyName,
net.minecraft.nbt.NBTBase tag)
Sets a tag for the provided key in the passed ItemStack
|
public static boolean hasTag(net.minecraft.item.ItemStack itemStack, java.lang.String keyName)
itemStack
- The stackkeyName
- The key for the tagpublic static void removeTag(net.minecraft.item.ItemStack itemStack, java.lang.String keyName)
itemStack
- The stackkeyName
- The key representing the tagpublic static long getLong(net.minecraft.item.ItemStack itemStack, java.lang.String keyName)
itemStack
- The stackkeyName
- The keypublic static void setLong(net.minecraft.item.ItemStack itemStack, java.lang.String keyName, long keyValue)
itemStack
- The stackkeyName
- The key representing the valuekeyValue
- The value for the keypublic static java.lang.String getString(net.minecraft.item.ItemStack itemStack, java.lang.String keyName)
itemStack
- The stackkeyName
- The keypublic static void setString(net.minecraft.item.ItemStack itemStack, java.lang.String keyName, java.lang.String keyValue)
itemStack
- The stackkeyName
- The key representing the valuekeyValue
- The value for the keypublic static boolean getBoolean(net.minecraft.item.ItemStack itemStack, java.lang.String keyName)
itemStack
- The stackkeyName
- The keypublic static void setBoolean(net.minecraft.item.ItemStack itemStack, java.lang.String keyName, boolean keyValue)
itemStack
- The stackkeyName
- The key representing the valuekeyValue
- The value for the keypublic static byte getByte(net.minecraft.item.ItemStack itemStack, java.lang.String keyName)
itemStack
- The stackkeyName
- The keypublic static void setByte(net.minecraft.item.ItemStack itemStack, java.lang.String keyName, byte keyValue)
itemStack
- The stackkeyName
- The key representing the valuekeyValue
- The value for the keypublic static short getShort(net.minecraft.item.ItemStack itemStack, java.lang.String keyName)
itemStack
- The stackkeyName
- The keypublic static void setShort(net.minecraft.item.ItemStack itemStack, java.lang.String keyName, short keyValue)
itemStack
- The stackkeyName
- The key representing the valuekeyValue
- The value for the keypublic static int getInt(net.minecraft.item.ItemStack itemStack, java.lang.String keyName)
itemStack
- The stackkeyName
- The keypublic static void setInteger(net.minecraft.item.ItemStack itemStack, java.lang.String keyName, int keyValue)
itemStack
- The stackkeyName
- The key representing the valuekeyValue
- The value for the keypublic static float getFloat(net.minecraft.item.ItemStack itemStack, java.lang.String keyName)
itemStack
- The stackkeyName
- The keypublic static void setFloat(net.minecraft.item.ItemStack itemStack, java.lang.String keyName, float keyValue)
itemStack
- The stackkeyName
- The key representing the valuekeyValue
- The value for the keypublic static double getDouble(net.minecraft.item.ItemStack itemStack, java.lang.String keyName)
itemStack
- The stackkeyName
- The keypublic static void setDouble(net.minecraft.item.ItemStack itemStack, java.lang.String keyName, double keyValue)
itemStack
- The stackkeyName
- The key representing the valuekeyValue
- The value for the keypublic static net.minecraft.nbt.NBTTagList getList(net.minecraft.item.ItemStack itemStack, java.lang.String keyName, int type)
NBTTagList
for the provided key in the passed ItemStackitemStack
- The stackkeyName
- The keytype
- The type of tag list, see Constants.NBT
public static void setList(net.minecraft.item.ItemStack itemStack, java.lang.String keyName, net.minecraft.nbt.NBTTagList tag)
NBTTagList
for the provided key in the passed ItemStackitemStack
- The stackkeyName
- The keytag
- The tag listpublic static void addInfo(net.minecraft.item.ItemStack itemStack, java.util.List<java.lang.String> text)
itemStack
- The stacktext
- The text for the descriptionpublic static void setInfo(net.minecraft.item.ItemStack itemStack, java.util.List<java.lang.String> text)
itemStack
- The stacktext
- The text for the descriptionpublic static void removeInfo(net.minecraft.item.ItemStack itemStack)
itemStack
- The stackpublic static void setTag(net.minecraft.item.ItemStack itemStack, java.lang.String keyName, net.minecraft.nbt.NBTBase tag)
itemStack
- The stackkeyName
- The keytag
- The tagpublic static net.minecraft.nbt.NBTBase getTag(net.minecraft.item.ItemStack itemStack, java.lang.String keyName)
itemStack
- The stackkeyName
- The keypublic static void setIntArray(net.minecraft.item.ItemStack itemStack, java.lang.String keyName, int[] array)
itemStack
- The stackkeyName
- The key representing the valuearray
- The value for the keypublic static int[] getIntArray(net.minecraft.item.ItemStack itemStack, java.lang.String keyName)
itemStack
- The stackkeyName
- The keypublic static void setCompoundTag(net.minecraft.item.ItemStack itemStack, java.lang.String keyName, net.minecraft.nbt.NBTTagCompound tag)
itemStack
- The stackkeyName
- The keytag
- The tagpublic static net.minecraft.nbt.NBTTagCompound getCompoundTag(net.minecraft.item.ItemStack itemStack, java.lang.String keyName)
itemStack
- The stackkeyName
- The key