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 Detail

      • remove

        void remove​(String key)
        Returns the tag with the given key from the compound tag.
        Parameters:
        key - the NBT key
      • has

        boolean has​(String key)
        Parameters:
        key - the NBT key
        Returns:
        True if the compound tag has a tag with the given key.
      • getBoolean

        boolean getBoolean​(String key)
      • setBoolean

        void setBoolean​(String key,
                        boolean value)
      • getShort

        short getShort​(String key)
      • setShort

        void setShort​(String key,
                      short value)
      • getInteger

        int getInteger​(String key)
      • setInteger

        void setInteger​(String key,
                        int value)
      • getByte

        byte getByte​(String key)
      • setByte

        void setByte​(String key,
                     byte value)
      • getLong

        long getLong​(String key)
      • setLong

        void setLong​(String key,
                     long value)
      • getDouble

        double getDouble​(String key)
      • setDouble

        void setDouble​(String key,
                       double value)
      • getFloat

        float getFloat​(String key)
      • setFloat

        void setFloat​(String key,
                      float value)
      • getByteArray

        byte[] getByteArray​(String key)
      • setByteArray

        void setByteArray​(String key,
                          byte[] value)
      • getIntegerArray

        int[] getIntegerArray​(String key)
      • setIntegerArray

        void setIntegerArray​(String key,
                             int[] value)
      • getList

        Object[] getList​(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.
        Parameters:
        key - the NBT key
        value - the list type
        Returns:
        The tag list of objects, depending on the tag type.
      • getListType

        int getListType​(String key)
        Returns the type of the tag list with this key, as an integer.
        Parameters:
        key - the NBT key
        Returns:
        the list element type
      • setList

        void setList​(String key,
                     Object[] value)
        Adds a new tag list to the compound tag with the given key.
        Parameters:
        key - The key for the list tag
        value - 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.
      • setCompound

        void setCompound​(String key,
                         INbt value)
      • getKeys

        String[] getKeys()
        Returns:
        A list of all the compound tag's keys.
      • getType

        int getType​(String key)
        Parameters:
        key - the NBT 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

        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.