Class ListData

java.lang.Object
com.blamejared.crafttweaker.api.data.ListData
All Implemented Interfaces:
IData, Comparable<IData>, Iterable<IData>

@ZenRegister public class ListData extends Object implements IData
DocParam:
this (["Hello", "World", "!"] as IData)
  • Constructor Details

    • ListData

      public ListData(net.minecraft.nbt.ListTag internal)
    • ListData

      public ListData()
    • ListData

      public ListData(List<IData> list)
    • ListData

      public ListData(IData[] array)
  • Method Details

    • getInternal

      public net.minecraft.nbt.ListTag getInternal()
      Description copied from interface: IData
      Gets the internal Tag stored in this IData.
      Specified by:
      getInternal in interface IData
      Returns:
      the vanilla Tag that this IData represents.
    • add

      public IData add(IData other)
      Description copied from interface: IData
      Adds the given IData to this IData.
      Specified by:
      add in interface IData
      Parameters:
      other - the other data to add.
      Returns:
      A new IData after adding the other data.
    • put

      public void put(String index, IData value)
      Description copied from interface: IData
      Puts the given value inside this IData at the given index.
      Specified by:
      put in interface IData
      Parameters:
      index - The key to store the data at
      value - The data to store.
    • remove

      public void remove(int index)
      Description copied from interface: IData
      Removes the stored data at the given index.
      Specified by:
      remove in interface IData
      Parameters:
      index - The index to remove.
    • getAt

      public IData getAt(int index)
      Description copied from interface: IData
      Gets the data at the given index.
      Specified by:
      getAt in interface IData
      Parameters:
      index - The index to get
      Returns:
      The data at the index.
    • contains

      public boolean contains(IData other)
      Description copied from interface: IData
      Checks if this IData contains the other IData

      For most data types, this will check equality of the data, but for map data, it will check if the other data is a string, and then check if it contains a key with that name

      Specified by:
      contains in interface IData
      Parameters:
      other - the other data to check
      Returns:
      true if this data contains the other data.
    • equalTo

      public boolean equalTo(IData other)
      Description copied from interface: IData
      Checks if this IData is equal to the other IData.
      Specified by:
      equalTo in interface IData
      Parameters:
      other - The data to check equality of.
      Returns:
      True if equal, false otherwise.
    • asList

      public List<IData> asList()
      Description copied from interface: IData
      Casts this IData to a list.
      Specified by:
      asList in interface IData
      Returns:
      this data as a list
    • isListable

      public boolean isListable()
      Description copied from interface: IData
      Checks if this data supports being cast to a list.
      Specified by:
      isListable in interface IData
      Returns:
      True if it can be cast to a list, false otherwise.
    • asByteArray

      public byte[] asByteArray()
      Description copied from interface: IData
      Casts this IData to a byte array.
      Specified by:
      asByteArray in interface IData
      Returns:
      this data as a byte array
    • asIntArray

      public int[] asIntArray()
      Description copied from interface: IData
      Casts this IData to an int array.
      Specified by:
      asIntArray in interface IData
      Returns:
      this data as an int array
    • asLongArray

      public long[] asLongArray()
      Description copied from interface: IData
      Casts this IData to a long array.
      Specified by:
      asLongArray in interface IData
      Returns:
      this data as a long array
    • length

      public int length()
      Description copied from interface: IData
      Gets the length of this IData.
      Specified by:
      length in interface IData
      Returns:
      The length of this IData.
    • getKeys

      public Set<String> getKeys()
      Description copied from interface: IData
      Gets the keys of this IData
      Specified by:
      getKeys in interface IData
      Returns:
      The keys of this IData.
    • iterator

      @NotNull public @NotNull Iterator<IData> iterator()
      Specified by:
      iterator in interface IData
      Specified by:
      iterator in interface Iterable<IData>
    • copy

      public IData copy()
      Specified by:
      copy in interface IData
    • copyInternal

      public IData copyInternal()
      Specified by:
      copyInternal in interface IData
    • accept

      public <T> T accept(DataVisitor<T> visitor)
      Specified by:
      accept in interface IData
    • getType

      public IData.Type getType()
      Description copied from interface: IData
      Gets the type of this IData.
      Specified by:
      getType in interface IData
      Returns:
      The type of this IData.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object