public final class ItemStackUtils
extends java.lang.Object
| Constructor and Description |
|---|
ItemStackUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
areStacksEqual(net.minecraft.item.ItemStack firstStack,
net.minecraft.item.ItemStack secondStack,
boolean checkNBT)
Checks if two given ItemStack are equal.
|
static boolean |
areStacksSimilar(net.minecraft.item.ItemStack firstStack,
net.minecraft.item.ItemStack secondStack)
Checks to see if two ItemStacks are similar.
|
static boolean |
areStacksSimilarWithSize(net.minecraft.item.ItemStack firstStack,
net.minecraft.item.ItemStack secondStack)
Checks to see if two ItemStacks are similar.
|
static boolean |
compareStackToOreName(net.minecraft.item.ItemStack stack,
java.lang.String oreName)
Compares all ore dictionary names associated with an ItemStack, with the provided ore
dictionary name.
|
static net.minecraft.item.ItemStack |
createStackFromString(java.lang.String stackString)
Reads an ItemStack from a string This method is intended for use in reading information
from a configuration file.
|
static net.minecraft.item.ItemStack |
decreaseStackSize(net.minecraft.item.ItemStack stack,
int amount)
Safely decreases the amount of items held by an ItemStack.
|
static boolean |
doStacksShareOreName(net.minecraft.item.ItemStack firstStack,
net.minecraft.item.ItemStack secondStack)
Compares all applicable ore dictionary names for two item stacks, to see if either have
a name in common.
|
static int |
getDyeColor(net.minecraft.item.ItemStack stack)
Retrieves the color associated with an ItemStack.
|
static int |
getItemColor(net.minecraft.item.ItemStack stack)
Retrieves the custom color of an ItemStack.
|
static boolean |
isStackInArray(net.minecraft.item.ItemStack stack,
boolean checkNBT,
net.minecraft.item.ItemStack... stacks)
A check to see if an ItemStack exists within an array of other ItemStack.
|
static boolean |
isValidStack(net.minecraft.item.ItemStack stack)
Checks if an ItemStack is valid.
|
static net.minecraft.nbt.NBTTagCompound |
prepareDataTag(net.minecraft.item.ItemStack stack)
Sets a stack compound to an ItemStack if it does not already have one.
|
static void |
removeItemColor(net.minecraft.item.ItemStack stack)
Removes all color data associated with an ItemStack.
|
static void |
setItemColor(net.minecraft.item.ItemStack stack,
int color)
Sets a color to an ItemStack.
|
static net.minecraft.item.ItemStack |
setLore(net.minecraft.item.ItemStack stack,
java.lang.String[] lore)
Sets the lore for an ItemStack.
|
static java.lang.String |
writeStackToString(net.minecraft.item.ItemStack stack)
Writes an ItemStack as a String.
|
static void |
writeStackToTag(net.minecraft.item.ItemStack stack,
net.minecraft.nbt.NBTTagCompound tag,
java.lang.String tagName)
Writes an ItemStack as a sub NBTTagCompound on a larger NBTTagCompound.
|
public static net.minecraft.nbt.NBTTagCompound prepareDataTag(net.minecraft.item.ItemStack stack)
stack: - ItemStack having a tag set on it.public static net.minecraft.item.ItemStack setLore(net.minecraft.item.ItemStack stack,
java.lang.String[] lore)
stack: - An instance of an ItemStack to write the lore to.lore: - An array containing the lore to write. Each line is a new entry.public static java.lang.String writeStackToString(net.minecraft.item.ItemStack stack)
stack: - The instance of ItemStack to write.public static net.minecraft.item.ItemStack createStackFromString(java.lang.String stackString)
stackString: - The string used to construct an ItemStack.public static int getDyeColor(net.minecraft.item.ItemStack stack)
stack: - The ItemStack to check for the color.public static boolean isValidStack(net.minecraft.item.ItemStack stack)
stack: - The ItemStack to check.public static boolean compareStackToOreName(net.minecraft.item.ItemStack stack,
java.lang.String oreName)
stack: - The ItemStack to compare against.oreName: - The ore dictionary name to compare to.public static boolean doStacksShareOreName(net.minecraft.item.ItemStack firstStack,
net.minecraft.item.ItemStack secondStack)
firstStack: - The first ItemStack to compare.secondStack: - The second ItemStack to compare.public static boolean areStacksSimilar(net.minecraft.item.ItemStack firstStack,
net.minecraft.item.ItemStack secondStack)
firstStack: - The first stack to check.secondStack: - The second stack to check.public static boolean areStacksSimilarWithSize(net.minecraft.item.ItemStack firstStack,
net.minecraft.item.ItemStack secondStack)
firstStack: - The first stack to check.secondStack: - The second stack to check.public static int getItemColor(net.minecraft.item.ItemStack stack)
stack: - The ItemStack to check the color of.public static void setItemColor(net.minecraft.item.ItemStack stack,
int color)
stack: - The ItemStack to change the color of.color: - A numeric representation of the color, that can be broken down into RGB
components.public static void removeItemColor(net.minecraft.item.ItemStack stack)
stack: - The ItemStack to remove the color from.public static void writeStackToTag(net.minecraft.item.ItemStack stack,
net.minecraft.nbt.NBTTagCompound tag,
java.lang.String tagName)
stack: - The ItemStack to write to the tag.tag: - The NBTTagCompound to write the stack to.tagName: - The name for this new NBTTagCompound entry.public static net.minecraft.item.ItemStack decreaseStackSize(net.minecraft.item.ItemStack stack,
int amount)
stack: - The ItemStack to decrease the size of.amount: - The amount to decrease the stack size by.public static boolean areStacksEqual(net.minecraft.item.ItemStack firstStack,
net.minecraft.item.ItemStack secondStack,
boolean checkNBT)
firstStack: - The first ItemStack to compare.secondStack: - The second ItemStack to compare.checkNBT: - Should NBT be checked as well?public static boolean isStackInArray(net.minecraft.item.ItemStack stack,
boolean checkNBT,
net.minecraft.item.ItemStack... stacks)
stack: - The ItemStack you are searching for.checkNBT: - Should the stacks need the same NBT for them to be the same?stacks: - The array of ItemStack to search through.