Class ItemData

java.lang.Object
com.saicone.rtag.item.ItemData

public class ItemData extends Object
Class to item-related data.
  • Field Details

  • Method Details

    • getComponentPath

      public static Object[] getComponentPath(Object... path) throws IndexOutOfBoundsException
      Convert old tag path into new component path.
      This method skips first key of tag path, it assumes the given path has "tag" at first element
      Parameters:
      path - the tag path to convert.
      Returns:
      a new component path representation of tag path.
      Throws:
      IndexOutOfBoundsException - if starting position of source or destination path is out of range.
    • getComponentPath

      public static Object[] getComponentPath(int srcPos, int destPos, Object... src) throws IndexOutOfBoundsException
      Convert old tag path into new component path.
      Every component path start with "components" key, if you want to skip that use a destPos of 1.
      Parameters:
      srcPos - starting position in the source path.
      destPos - starting position in the extracted destination data.
      src - the source path array.
      Returns:
      a new component path representation of tag path.
      Throws:
      IndexOutOfBoundsException - if starting position of source or destination path is out of range.
    • getTagPath

      public static Object[] getTagPath(Object... path) throws IndexOutOfBoundsException
      Convert new component path into old tag path.
      This method skips first key of component path, it assumes the given path has "components" at first element
      Parameters:
      path - the component path to convert.
      Returns:
      an old tag path representation of component path.
      Throws:
      IndexOutOfBoundsException - if starting position of source or destination path is out of range.
    • getTagPath

      public static Object[] getTagPath(int srcPos, int destPos, Object... src) throws IndexOutOfBoundsException
      Convert new component path into old tag path.
      Most tag paths start with "tag" key, if you want to skip that use a destPos of 1.
      Parameters:
      srcPos - starting position in the source path.
      destPos - starting position in the extracted destination data.
      src - the source path array.
      Returns:
      an old tag path representation of component path.
      Throws:
      IndexOutOfBoundsException - if starting position of source or destination path is out of range.
    • getItemVersion

      @Nullable @Contract("null -> null") @Deprecated(since="1.5.14") public static @Nullable Float getItemVersion(@Nullable @Nullable Object compound)
      Deprecated.
      Get current version number from item compound.
      Parameters:
      compound - CompoundTag that represent an item.
      Returns:
      A valid version number or null.
    • lookupVersion

      @Nullable @Contract("null -> null") public static @Nullable com.saicone.rtag.util.MC lookupVersion(@Nullable @Nullable Object compound)
      Lookup item version number by reading its data.
      Parameters:
      compound - a tag compound that represents item data.
      Returns:
      the found version if found, null otherwise.
    • lookupVersion

      @Nullable @Internal public static @Nullable com.saicone.rtag.util.MC lookupVersion(@NotNull @NotNull Map<String,Object> value)
      Lookup item version number by reading its data.
      Parameters:
      value - a tag compound value that represents item data.
      Returns:
      the found version if found, null otherwise.