Class MapData

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

@ZenRegister public class MapData extends Object implements IData
DocParam:
this (Hello: "World", Somewhere: "Over the rainbow")
  • Constructor Details

    • MapData

      public MapData(net.minecraft.nbt.CompoundTag internal, Set<String> boolDataKeys)
    • MapData

      public MapData(net.minecraft.nbt.CompoundTag internal)
    • MapData

      public MapData()
    • MapData

      public MapData(Map<String,IData> map)
  • Method Details

    • putAll

      public void putAll(Map<String,IData> map)
      Adds all entries from the given map into this one. Can override existing keys.
      Parameters:
      map - The other entries to be added to this map
      DocParam:
      map {Hello: "Goodbye", Item: "Bedrock"}
    • 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.
    • remove

      public void remove(String key)
      Description copied from interface: IData
      Removes the stored data at the given key.
      Specified by:
      remove in interface IData
      Parameters:
      key - The key 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.
    • getAt

      public IData getAt(String key)
      Description copied from interface: IData
      Gets the data at the given key.
      Specified by:
      getAt in interface IData
      Parameters:
      key - The key to get
      Returns:
      The data at the key.
    • 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.
    • put

      public void put(String name, IData data)
      Description copied from interface: IData
      Puts the given value inside this IData at the given index.
      Specified by:
      put in interface IData
      Parameters:
      name - The key to store the data at
      data - The data to store.
    • 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.
    • isMappable

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

      public Map<String,IData> asMap()
      Description copied from interface: IData
      Casts this IData to a map.
      Specified by:
      asMap in interface IData
      Returns:
      this data as a map
    • 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>
    • getInternal

      public net.minecraft.nbt.CompoundTag 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.
    • 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.
    • boolDataKeys

      public Set<String> boolDataKeys()
    • merge

      public IData merge(IData other)
      Description copied from interface: IData
      Merges the given data with this data.
      Specified by:
      merge in interface IData
      Parameters:
      other - the data to merge
      Returns:
      the result of merging the datas.
    • 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