Class ItemData
java.lang.Object
com.saicone.rtag.item.ItemData
Class to item-related data.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic Object[]getComponentPath(int srcPos, int destPos, Object... src) 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.static Object[]getComponentPath(Object... path) 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 elementgetItemVersion(@Nullable Object compound) Deprecated.static Object[]getTagPath(int srcPos, int destPos, Object... src) 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.static Object[]getTagPath(Object... path) 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 elementstatic @Nullable com.saicone.rtag.util.MClookupVersion(@Nullable Object compound) Lookup item version number by reading its data.static @Nullable com.saicone.rtag.util.MClookupVersion(@NotNull Map<String, Object> value) Lookup item version number by reading its data.
-
Field Details
-
VERSION_KEY
-
-
Method Details
-
getComponentPath
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
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
-