Package noppes.npcs.api
Interface INbt
-
public interface INbt
A scripted data representation of an MC NBTTagCompound object. Using these functions modifies the compound tag associated with this object. Any changes made to the compound tag are made directly to its "tagMap" attribute, minimizing the impact of setting/getting NBT data with this object on performance. Compound tags, unlike list tags, can contain multiple types of NBT tag types. Compound tags can even contain compound tags inside them, and if that compound tag is accessed, an object like this one will also be returned! Every tag inside a compound tag has a -unique- "key". If you try to put another tag of the same key inside the compound tag, it will replace the previous tag. The types and their type as an integer are as follows: 1: Byte 2: Short 3: Int 4: Long 5: Float 6: Double 7: Byte array 8: String 9: Tag list 10: Compound 11: Integer array
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clear()
Completely clears the compound tag of all tags inside it.boolean
getBoolean(java.lang.String key)
byte
getByte(java.lang.String key)
byte[]
getByteArray(java.lang.String key)
INbt
getCompound(java.lang.String key)
double
getDouble(java.lang.String key)
float
getFloat(java.lang.String key)
int
getInteger(java.lang.String key)
int[]
getIntegerArray(java.lang.String key)
java.lang.String[]
getKeys()
java.lang.Object[]
getList(java.lang.String key, int value)
Returns a tag list of objects with this key in the compound tag.int
getListType(java.lang.String key)
Returns the type of the tag list with this key, as an integer.long
getLong(java.lang.String key)
net.minecraft.nbt.NBTTagCompound
getMCNBT()
short
getShort(java.lang.String key)
java.lang.String
getString(java.lang.String key)
int
getType(java.lang.String key)
boolean
has(java.lang.String key)
boolean
isEqual(INbt nbt)
void
remove(java.lang.String key)
Returns the tag with the given key from the compound tag.void
setBoolean(java.lang.String key, boolean value)
void
setByte(java.lang.String key, byte value)
void
setByteArray(java.lang.String key, byte[] value)
void
setCompound(java.lang.String key, INbt value)
void
setDouble(java.lang.String key, double value)
void
setFloat(java.lang.String key, float value)
void
setInteger(java.lang.String key, int value)
void
setIntegerArray(java.lang.String key, int[] value)
void
setList(java.lang.String key, java.lang.Object[] value)
Adds a new tag list to the compound tag with the given key.void
setLong(java.lang.String key, long value)
void
setShort(java.lang.String key, short value)
void
setString(java.lang.String key, java.lang.String value)
java.lang.String
toJsonString()
-
-
-
Method Detail
-
remove
void remove(java.lang.String key)
Returns the tag with the given key from the compound tag.
-
has
boolean has(java.lang.String key)
- Returns:
- True if the compound tag has a tag with the given key.
-
getBoolean
boolean getBoolean(java.lang.String key)
-
setBoolean
void setBoolean(java.lang.String key, boolean value)
-
getShort
short getShort(java.lang.String key)
-
setShort
void setShort(java.lang.String key, short value)
-
getInteger
int getInteger(java.lang.String key)
-
setInteger
void setInteger(java.lang.String key, int value)
-
getByte
byte getByte(java.lang.String key)
-
setByte
void setByte(java.lang.String key, byte value)
-
getLong
long getLong(java.lang.String key)
-
setLong
void setLong(java.lang.String key, long value)
-
getDouble
double getDouble(java.lang.String key)
-
setDouble
void setDouble(java.lang.String key, double value)
-
getFloat
float getFloat(java.lang.String key)
-
setFloat
void setFloat(java.lang.String key, float value)
-
getString
java.lang.String getString(java.lang.String key)
-
setString
void setString(java.lang.String key, java.lang.String value)
-
getByteArray
byte[] getByteArray(java.lang.String key)
-
setByteArray
void setByteArray(java.lang.String key, byte[] value)
-
getIntegerArray
int[] getIntegerArray(java.lang.String key)
-
setIntegerArray
void setIntegerArray(java.lang.String key, int[] value)
-
getList
java.lang.Object[] getList(java.lang.String key, int value)
Returns a tag list of objects with this key in the compound tag. All the objects in the list will always be of the same type.- Returns:
- The tag list of objects, depending on the tag type.
-
getListType
int getListType(java.lang.String key)
Returns the type of the tag list with this key, as an integer.
-
setList
void setList(java.lang.String key, java.lang.Object[] value)
Adds a new tag list to the compound tag with the given key.- Parameters:
key
- The key for the list tagvalue
- The list of objects to be in the list. The type of the first element in this list becomes the tag list's type, and if later objects are not of this type, they will not be added.
-
getCompound
INbt getCompound(java.lang.String key)
-
setCompound
void setCompound(java.lang.String key, INbt value)
-
getKeys
java.lang.String[] getKeys()
- Returns:
- A list of all the compound tag's keys.
-
getType
int getType(java.lang.String key)
- Returns:
- The type of the tag with the input key as an integer.
-
getMCNBT
net.minecraft.nbt.NBTTagCompound getMCNBT()
- Returns:
- An obfuscated MC NBTTagCompound object.
-
toJsonString
java.lang.String toJsonString()
- Returns:
- A curly-bracket formatted JSON string of all the compound tag.
-
isEqual
boolean isEqual(INbt nbt)
-
clear
void clear()
Completely clears the compound tag of all tags inside it.
-
-