All Known Subinterfaces:
ICollectionData, INumberData
All Known Implementing Classes:
BoolData, ByteArrayData, ByteData, DoubleData, FloatData, IntArrayData, IntData, ListData, LongArrayData, LongData, MapData, ShortData, StringData

@ZenRegister(loaders={"crafttweaker","tags"}) public interface IData
The IData interface is a generic Interface for handling Data like NBT. You can cast about all primitives (short, double, string, int, ...) as well as certain arrays to IData. Remember that while they offer similar features, IData and their counterparts are NOT the same, which is why they will be referred to as DataTypes (e.g. ByteData).
DocParam:
this {Display: {lore: ["Hello", "World"]}}
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    Used to specify what "type" of IData this is.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    accept(DataVisitor<T> visitor)
     
    default boolean
     
     
    default List<IData>
    Gets a List representation of this IData, returns null on anything but ListData.
    default Map<String,IData>
    Gets a Map<String, IData> representation of this IData, returns null on anything but MapData.
    default INumberData
     
    default String
    Gets the String representation of this IData
    default boolean
    Checks if this IData contains another IData, mainly used in subclasses of ICollectionData, is the same as an equals check on other IData types
    Makes a copy of this IData.
    Makes a copy of this IData with a copy of the internal INBT object.
    default byte
    Gets the ID of the internal NBT tag.
    net.minecraft.nbt.Tag
    Gets the internal INBT stored in this IData.
    default String
    Gets the String representation of the internal INBT tag
    Gets the type of this IData.
  • Method Details

    • getId

      default byte getId()
      Gets the ID of the internal NBT tag. Used to determine what NBT type is stored (in a list for example)
      Returns:
      ID of the NBT tag that this data represents.
    • copy

      IData copy()
      Makes a copy of this IData. IData is immutable by default, use this to create a proper copy of the object.
      Returns:
      a copy of this IData.
    • copyInternal

      IData copyInternal()
      Makes a copy of this IData with a copy of the internal INBT object.
      Returns:
      a copy of this IData with a copy of the internal INBT object.
    • getInternal

      net.minecraft.nbt.Tag getInternal()
      Gets the internal INBT stored in this IData.
      Returns:
      the vanilla INBT tag that this IData represents.
    • getString

      default String getString()
      Gets the String representation of the internal INBT tag
      Returns:
      String that represents the internal INBT of this IData.
    • contains

      default boolean contains(IData data)
      Checks if this IData contains another IData, mainly used in subclasses of ICollectionData, is the same as an equals check on other IData types
      Parameters:
      data - data to check if it is contained
      Returns:
      true if the given IData is contained in this IData
      DocParam:
      data "Display"
    • asMap

      default Map<String,IData> asMap()
      Gets a Map<String, IData> representation of this IData, returns null on anything but MapData.
      Returns:
      null if this IData is not a map.
    • asList

      default List<IData> asList()
      Gets a List representation of this IData, returns null on anything but ListData.
      Returns:
      null if this IData is not a list.
    • asString

      default String asString()
      Gets the String representation of this IData
      Returns:
      String that represents this IData (value and type).
    • asNumber

      default INumberData asNumber()
    • asCollection

      default ICollectionData asCollection()
    • asBoolean

      default boolean asBoolean()
    • getType

      IData.Type getType()
      Gets the type of this IData.
      Returns:
      The type of this IData.
    • accept

      <T> T accept(DataVisitor<T> visitor)