Interface NbtBase<TType>

Type Parameters:
TType - - type of the value that is stored.
All Superinterfaces:
ClonableWrapper
All Known Subinterfaces:
NbtCompound, NbtList<TType>, NbtWrapper<TType>

public interface NbtBase<TType> extends ClonableWrapper
Represents a generic container for an NBT element.

Use NbtFactory to load or create an instance.

  • Method Details

    • accept

      boolean accept(NbtVisitor visitor)
      Accepts a NBT visitor.
      Parameters:
      visitor - - the hierarchical NBT visitor.
      Returns:
      TRUE if the parent should continue processing children at the current level, FALSE otherwise.
    • getType

      NbtType getType()
      Retrieve the type of this NBT element.
      Returns:
      The type of this NBT element.
    • getName

      String getName()
      Retrieve the name of this NBT tag.

      This will be an empty string if the NBT tag is stored in a list.

      Returns:
      Name of the tag.
    • setName

      void setName(String name)
      Set the name of this NBT tag.

      This will be ignored if the NBT tag is stored in a list.

      Parameters:
      name - - name of the tag.
    • getValue

      TType getValue()
      Retrieve the value of this NBT tag.

      Is either a primitive wrapper, String, List or a Map.

      Users are encouraged to cast an NBT compound to NbtCompound and use its put and get-methods instead of accessing its content from getValue().

      All operations that modify collections directly, such as List.add(Object) or Map.clear(), are considered optional. This also include members in Iterator and ListIterator. Operations that are not implemented throw a UnsupportedOperationException.

      Returns:
      Value of this tag.
    • setValue

      void setValue(TType newValue)
      Set the value of this NBT tag.
      Parameters:
      newValue - - the new value of this tag.
    • deepClone

      NbtBase<TType> deepClone()
      Clone the current NBT tag.
      Specified by:
      deepClone in interface ClonableWrapper
      Returns:
      The cloned tag.
    • getHandle

      default Object getHandle()
      Specified by:
      getHandle in interface ClonableWrapper