public class NBTUtils
extends java.lang.Object
| Constructor and Description |
|---|
NBTUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.List<net.minecraft.util.text.ITextComponent> |
deserializeTextComponents(net.minecraft.nbt.ListNBT l) |
static boolean |
fromTag(net.minecraft.nbt.CompoundNBT tag,
java.lang.String name,
boolean def) |
static float |
fromTag(net.minecraft.nbt.CompoundNBT tag,
java.lang.String name,
float def) |
static int |
fromTag(net.minecraft.nbt.CompoundNBT tag,
java.lang.String name,
int def) |
static java.lang.String |
fromTag(net.minecraft.nbt.CompoundNBT tag,
java.lang.String name,
java.lang.String def) |
static boolean |
getBoolean(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName)
Gets a Boolean value of the given tag from the
CompoundNBT of
the given ItemStack. |
static byte |
getByte(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName)
Gets a Byte value of the given tag from the
CompoundNBT of the
given ItemStack. |
static net.minecraft.nbt.CompoundNBT |
getCompoundTag(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName)
Gets a
CompoundNBT value of the given tag from the
CompoundNBT of the given ItemStack. |
static double |
getDouble(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName)
Gets a Double value of the given tag from the
CompoundNBT of
the given ItemStack. |
static float |
getFloat(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName)
Gets a Float value of the given tag from the
CompoundNBT of
the given ItemStack. |
static int |
getInteger(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName)
Gets an Integer value of the given tag from the
CompoundNBT of
the given ItemStack. |
static long |
getLong(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName)
Gets a Long value of the given tag from the
CompoundNBT of the
given ItemStack. |
static net.minecraft.util.math.BlockPos |
getPos(net.minecraft.nbt.CompoundNBT tag) |
static net.minecraft.util.math.BlockPos |
getPos(net.minecraft.item.ItemStack stack) |
static short |
getShort(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName)
Gets a Short value of the given tag from the
CompoundNBT of
the given ItemStack. |
static java.lang.String |
getString(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName)
Gets a String value of the given tag from the
CompoundNBT of
the given ItemStack. |
static boolean |
hasTag(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName)
Checks if the
CompoundNBT of the given ItemStack has a
given tag. |
static void |
initNBTTagCompound(net.minecraft.item.ItemStack itemStack)
Initializes the
CompoundNBT for the given ItemStack if
it is null. |
static void |
removeTag(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName)
Removes the given tag from the
CompoundNBT of the given
ItemStack. |
static net.minecraft.nbt.ListNBT |
serializeTextComponents(java.util.List<net.minecraft.util.text.ITextComponent> textComponents) |
static void |
setBoolean(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName,
boolean tagValue)
Sets the given boolean value for the given tag on the
CompoundNBT of the given ItemStack. |
static void |
setByte(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName,
byte tagValue)
Sets the given byte value for the given tag on the
CompoundNBT
of the given ItemStack. |
static void |
setCompoundTag(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName,
net.minecraft.nbt.INBT tagValue)
Sets the given
CompoundNBT value for the given tag on the
CompoundNBT of the given ItemStack. |
static void |
setDouble(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName,
double tagValue)
Sets the given double value for the given tag on the
CompoundNBT of the given ItemStack. |
static void |
setFloat(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName,
float tagValue)
Sets the given float value for the given tag on the
CompoundNBT of the given ItemStack. |
static void |
setInteger(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName,
int tagValue)
Sets the given integer value for the given tag on the
CompoundNBT of the given ItemStack. |
static void |
setLong(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName,
long tagValue)
Sets the given long value for the given tag on the
CompoundNBT
of the given ItemStack. |
static void |
setPos(net.minecraft.nbt.CompoundNBT tag,
net.minecraft.util.math.vector.Vector3i vec) |
static void |
setPos(net.minecraft.item.ItemStack stack,
net.minecraft.util.math.vector.Vector3i vec) |
static void |
setShort(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName,
short tagValue)
Sets the given short value for the given tag on the
CompoundNBT of the given ItemStack. |
static void |
setString(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName,
java.lang.String tagValue)
Sets the given String value for the given tag on the
CompoundNBT of the given ItemStack. |
public static void initNBTTagCompound(net.minecraft.item.ItemStack itemStack)
CompoundNBT for the given ItemStack if
it is null.itemStack - The ItemStack which holds the CompoundNBT.public static boolean hasTag(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName)
CompoundNBT of the given ItemStack has a
given tag.itemStack - The ItemStack which holds the CompoundNBT.tagName - The name of the tag which should be checked.CompoundNBT has the tag otherwise false.public static void removeTag(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName)
CompoundNBT of the given
ItemStack.itemStack - The ItemStack which holds the CompoundNBT.tagName - The name of the tag which should be removed.public static java.lang.String getString(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName)
CompoundNBT of
the given ItemStack. If the CompoundNBT is null it
will be initialized.itemStack - The ItemStack which holds the CompoundNBT.tagName - The name of the tag for which the value should be determined.public static void setString(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName,
java.lang.String tagValue)
CompoundNBT of the given ItemStack. If the
CompoundNBT is null it will be initialized.itemStack - The ItemStack which holds the CompoundNBT.tagName - The name of the tag which should be set.tagValue - The value which should be set to the given tag as a String.public static boolean getBoolean(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName)
CompoundNBT of
the given ItemStack. If the CompoundNBT is null it
will be initialized.itemStack - The ItemStack which holds the CompoundNBT.tagName - The name of the tag for which the value should be determined.public static void setBoolean(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName,
boolean tagValue)
CompoundNBT of the given ItemStack. If the
CompoundNBT is null it will be initialized.itemStack - The ItemStack which holds the CompoundNBT.tagName - The name of the tag which should be set.tagValue - The value which should be set to the given tag as a boolean.public static byte getByte(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName)
CompoundNBT of the
given ItemStack. If the CompoundNBT is null it will be
initialized.itemStack - The ItemStack which holds the CompoundNBT.tagName - The name of the tag for which the value should be determined.public static void setByte(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName,
byte tagValue)
CompoundNBT
of the given ItemStack. If the CompoundNBT is null it
will be initialized.itemStack - The ItemStack which holds the CompoundNBT.tagName - The name of the tag which should be set.tagValue - The value which should be set to the given tag as a byte.public static short getShort(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName)
CompoundNBT of
the given ItemStack. If the CompoundNBT is null it
will be initialized.itemStack - The ItemStack which holds the CompoundNBT.tagName - The name of the tag for which the value should be determined.public static void setShort(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName,
short tagValue)
CompoundNBT of the given ItemStack. If the
CompoundNBT is null it will be initialized.itemStack - The ItemStack which holds the CompoundNBT.tagName - The name of the tag which should be set.tagValue - The value which should be set to the given tag as a short.public static int getInteger(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName)
CompoundNBT of
the given ItemStack. If the CompoundNBT is null it
will be initialized.itemStack - The ItemStack which holds the CompoundNBT.tagName - The name of the tag for which the value should be determined.public static void setInteger(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName,
int tagValue)
CompoundNBT of the given ItemStack. If the
CompoundNBT is null it will be initialized.itemStack - The ItemStack which holds the CompoundNBT.tagName - The name of the tag which should be set.tagValue - The value which should be set to the given tag as an integer.public static long getLong(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName)
CompoundNBT of the
given ItemStack. If the CompoundNBT is null it will be
initialized.itemStack - The ItemStack which holds the CompoundNBT.tagName - The name of the tag for which the value should be determined.public static void setLong(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName,
long tagValue)
CompoundNBT
of the given ItemStack. If the CompoundNBT is null it
will be initialized.itemStack - The ItemStack which holds the CompoundNBT.tagName - The name of the tag which should be set.tagValue - The value which should be set to the given tag as a long.public static float getFloat(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName)
CompoundNBT of
the given ItemStack. If the CompoundNBT is null it
will be initialized.itemStack - The ItemStack which holds the CompoundNBT.tagName - The name of the tag for which the value should be determined.public static void setFloat(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName,
float tagValue)
CompoundNBT of the given ItemStack. If the
CompoundNBT is null it will be initialized.itemStack - The ItemStack which holds the CompoundNBT.tagName - The name of the tag which should be set.tagValue - The value which should be set to the given tag as a float.public static double getDouble(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName)
CompoundNBT of
the given ItemStack. If the CompoundNBT is null it
will be initialized.itemStack - The ItemStack which holds the CompoundNBT.tagName - The name of the tag for which the value should be determined.public static void setDouble(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName,
double tagValue)
CompoundNBT of the given ItemStack. If the
CompoundNBT is null it will be initialized.itemStack - The ItemStack which holds the CompoundNBT.tagName - The name of the tag which should be set.tagValue - The value which should be set to the given tag as a double.public static net.minecraft.nbt.CompoundNBT getCompoundTag(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName)
CompoundNBT value of the given tag from the
CompoundNBT of the given ItemStack. If the
CompoundNBT is null it will be initialized.itemStack - The ItemStack which holds the CompoundNBT.tagName - The name of the tag for which the value should be determined.CompoundNBT.public static void setCompoundTag(net.minecraft.item.ItemStack itemStack,
java.lang.String tagName,
net.minecraft.nbt.INBT tagValue)
CompoundNBT value for the given tag on the
CompoundNBT of the given ItemStack. If the
CompoundNBT is null it will be initialized.itemStack - The ItemStack which holds the CompoundNBT.tagName - The name of the tag which should be set.tagValue - The value which should be set to the given tag as a
CompoundNBT.public static void setPos(net.minecraft.item.ItemStack stack,
net.minecraft.util.math.vector.Vector3i vec)
public static net.minecraft.util.math.BlockPos getPos(net.minecraft.item.ItemStack stack)
public static void setPos(net.minecraft.nbt.CompoundNBT tag,
net.minecraft.util.math.vector.Vector3i vec)
public static net.minecraft.util.math.BlockPos getPos(net.minecraft.nbt.CompoundNBT tag)
public static boolean fromTag(net.minecraft.nbt.CompoundNBT tag,
java.lang.String name,
boolean def)
public static int fromTag(net.minecraft.nbt.CompoundNBT tag,
java.lang.String name,
int def)
public static java.lang.String fromTag(net.minecraft.nbt.CompoundNBT tag,
java.lang.String name,
java.lang.String def)
public static float fromTag(net.minecraft.nbt.CompoundNBT tag,
java.lang.String name,
float def)
public static net.minecraft.nbt.ListNBT serializeTextComponents(java.util.List<net.minecraft.util.text.ITextComponent> textComponents)
public static java.util.List<net.minecraft.util.text.ITextComponent> deserializeTextComponents(net.minecraft.nbt.ListNBT l)