Class IMaterialMirror
java.lang.Object
com.saicone.rtag.item.mirror.IMaterialMirror
- All Implemented Interfaces:
ItemMirror
IMaterialMirror to convert item material IDs
across version.
This is probably the most complex mirror instance in Rtag.
This is probably the most complex mirror instance in Rtag.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an simple IMaterialMirror with cache duration of 3 hours.IMaterialMirror(long duration, @NotNull TimeUnit unit, @NotNull String defaultMaterial) Constructs an IMaterialMirror with specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoiddowngrade(@NotNull Object compound, @NotNull String id, @NotNull com.saicone.rtag.util.MC from, @NotNull com.saicone.rtag.util.MC to) Downgrade current item tag compound from upper version.voiddowngrade(@NotNull Object compound, @NotNull String id, @NotNull Object components, @NotNull com.saicone.rtag.util.MC from, @NotNull com.saicone.rtag.util.MC to) Downgrade current item tag compound from upper version.intgetDamage(@NotNull Object compound, @Nullable Object components, @NotNull com.saicone.rtag.util.MC version) Get current item damage depending on item version.intDeprecated, for removal: This API element is subject to removal in a future version.getEggEntity(@NotNull Object compound, @NotNull com.saicone.rtag.util.MC version) Get current item entity, method for legacy SPAWN_EGG items.getEggEntity(Object compound, float version) Deprecated, for removal: This API element is subject to removal in a future version.voidresolveItem(@NotNull Object compound, ItemMaterialTag.Data material, @Nullable Object components, @NotNull com.saicone.rtag.util.MC from, @NotNull com.saicone.rtag.util.MC to) Resolver current item compound with new material to set.voidresolveItem(Object compound, String material, Object components, float from, float to) Deprecated, for removal: This API element is subject to removal in a future version.voidresolveMaterial(@NotNull Object compound, @NotNull String id, int damage, @Nullable Object components, @NotNull com.saicone.rtag.util.MC from, @NotNull com.saicone.rtag.util.MC to) Resolve material of the item, this method checks if the ID needs to be converted.voidresolveMaterial(Object compound, String id, int damage, Object components, float from, float to) Deprecated, for removal: This API element is subject to removal in a future version.voidresolveSaved(@NotNull Object compound, @NotNull String id, int damage, @NotNull Object components, @NotNull com.saicone.rtag.util.MC from, @NotNull com.saicone.rtag.util.MC to) Resolve an ItemStack if it contains "savedID" inside custom data component.voidresolveSaved(Object compound, String id, int damage, Object components, float from, float to) Deprecated, for removal: This API element is subject to removal in a future version.voidsetDamage(@NotNull Object compound, @Nullable Object components, int damage, @NotNull com.saicone.rtag.util.MC from, @NotNull com.saicone.rtag.util.MC to) Set item damage depending on item version, this method removes old damage tag if the conversion is across legacy-flat.voidDeprecated, for removal: This API element is subject to removal in a future version.translate(ItemMaterialTag.Data material, @NotNull com.saicone.rtag.util.MC from, @NotNull com.saicone.rtag.util.MC to) Translate given material and version pair into current server version.Deprecated, for removal: This API element is subject to removal in a future version.voidupgrade(@NotNull Object compound, @NotNull String id, @NotNull com.saicone.rtag.util.MC from, @NotNull com.saicone.rtag.util.MC to) Upgrade current item tag compound from lower version.voidupgrade(@NotNull Object compound, @NotNull String id, @NotNull Object components, @NotNull com.saicone.rtag.util.MC from, @NotNull com.saicone.rtag.util.MC to) Upgrade current item tag compound from lower version.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ItemMirror
downgrade, downgrade, getDeprecationVersion, getMaximumVersion, getMinimumVersion, getMinVersion0, upgrade, upgrade
-
Constructor Details
-
IMaterialMirror
public IMaterialMirror()Constructs an simple IMaterialMirror with cache duration of 3 hours. -
IMaterialMirror
-
-
Method Details
-
upgrade
public void upgrade(@NotNull @NotNull Object compound, @NotNull @NotNull String id, @NotNull @NotNull com.saicone.rtag.util.MC from, @NotNull @NotNull com.saicone.rtag.util.MC to) Description copied from interface:ItemMirrorUpgrade current item tag compound from lower version.- Specified by:
upgradein interfaceItemMirror- Parameters:
compound- the tag compound that represents item data.id- the item material id.from- the initial version of item data.to- the version to upgrade item data.
-
upgrade
public void upgrade(@NotNull @NotNull Object compound, @NotNull @NotNull String id, @NotNull @NotNull Object components, @NotNull @NotNull com.saicone.rtag.util.MC from, @NotNull @NotNull com.saicone.rtag.util.MC to) Description copied from interface:ItemMirrorUpgrade current item tag compound from lower version.- Specified by:
upgradein interfaceItemMirror- Parameters:
compound- the tag compound that represents item data.id- the item material id.components- the item components, on older versions this may be the item tag.from- the initial version of item data.to- the version to upgrade item data.
-
downgrade
public void downgrade(@NotNull @NotNull Object compound, @NotNull @NotNull String id, @NotNull @NotNull com.saicone.rtag.util.MC from, @NotNull @NotNull com.saicone.rtag.util.MC to) Description copied from interface:ItemMirrorDowngrade current item tag compound from upper version.- Specified by:
downgradein interfaceItemMirror- Parameters:
compound- the tag compound that represents item data.id- the item material id.from- the initial version of item data.to- the version to downgrade item data.
-
downgrade
public void downgrade(@NotNull @NotNull Object compound, @NotNull @NotNull String id, @NotNull @NotNull Object components, @NotNull @NotNull com.saicone.rtag.util.MC from, @NotNull @NotNull com.saicone.rtag.util.MC to) Description copied from interface:ItemMirrorDowngrade current item tag compound from upper version.- Specified by:
downgradein interfaceItemMirror- Parameters:
compound- the tag compound that represents item data.id- the item material id.components- the item components, on older versions this may be the item tag.from- the initial version of item data.to- the version to downgrade item data.
-
resolveSaved
@Internal public void resolveSaved(@NotNull @NotNull Object compound, @NotNull @NotNull String id, int damage, @NotNull @NotNull Object components, @NotNull @NotNull com.saicone.rtag.util.MC from, @NotNull @NotNull com.saicone.rtag.util.MC to) Resolve an ItemStack if it contains "savedID" inside custom data component.- Parameters:
compound- the tag compound that represent item data.id- the id of the item.damage- the item damage amount.components- the item components, on older versions this can be item tag.from- the original version from item.to- the version to convert item.
-
resolveMaterial
@Internal public void resolveMaterial(@NotNull @NotNull Object compound, @NotNull @NotNull String id, int damage, @Nullable @Nullable Object components, @NotNull @NotNull com.saicone.rtag.util.MC from, @NotNull @NotNull com.saicone.rtag.util.MC to) Resolve material of the item, this method checks if the ID needs to be converted.- Parameters:
compound- item representation as CompoundTag.id- ID of the item.damage- Damage amount.components- Item components.from- Version specified in compound.to- Version to convert.
-
resolveItem
@Internal public void resolveItem(@NotNull @NotNull Object compound, @NotNull ItemMaterialTag.Data material, @Nullable @Nullable Object components, @NotNull @NotNull com.saicone.rtag.util.MC from, @NotNull @NotNull com.saicone.rtag.util.MC to) Resolver current item compound with new material to set.- Parameters:
compound- Item CompoundTag.material- Material to set.components- Item components.from- Version specified in compound.to- Version to convert.
-
setDamage
@Internal public void setDamage(@NotNull @NotNull Object compound, @Nullable @Nullable Object components, int damage, @NotNull @NotNull com.saicone.rtag.util.MC from, @NotNull @NotNull com.saicone.rtag.util.MC to) Set item damage depending on item version, this method removes old damage tag if the conversion is across legacy-flat.- Parameters:
compound- Item CompoundTag.components- Item components.damage- Damage amount to set.from- Version specified in compoundto- Version to convert.
-
getDamage
@Internal public int getDamage(@NotNull @NotNull Object compound, @Nullable @Nullable Object components, @NotNull @NotNull com.saicone.rtag.util.MC version) Get current item damage depending on item version.- Parameters:
compound- Item CompoundTag.components- Item components.version- Version of the item.- Returns:
- A integer representing item damage.
-
getEggEntity
@NotNull @Internal public @NotNull String getEggEntity(@NotNull @NotNull Object compound, @NotNull @NotNull com.saicone.rtag.util.MC version) Get current item entity, method for legacy SPAWN_EGG items.- Parameters:
compound- Item CompoundTag.version- Item version- Returns:
- A string representing entity id.
-
translate
@NotNull @Internal public ItemMaterialTag.Data translate(@NotNull ItemMaterialTag.Data material, @NotNull @NotNull com.saicone.rtag.util.MC from, @NotNull @NotNull com.saicone.rtag.util.MC to) Translate given material and version pair into current server version.- Parameters:
material- Material to translate.from- Version specified in compoundto- Version to convert.- Returns:
- A string representing current server version material.
-
resolveSaved
@Deprecated(since="1.5.14", forRemoval=true) public void resolveSaved(Object compound, String id, int damage, Object components, float from, float to) Deprecated, for removal: This API element is subject to removal in a future version.Resolve an ItemStack if it contains "savedID" inside custom data component.- Parameters:
compound- Item CompoundTag.id- ID of the item.damage- Damage amount.components- Item components.from- Version specified in compound.to- Version to convert.
-
resolveMaterial
@Deprecated(since="1.5.14", forRemoval=true) public void resolveMaterial(Object compound, String id, int damage, Object components, float from, float to) Deprecated, for removal: This API element is subject to removal in a future version.Resolve material of the item, this method checks if the ID needs to be converted.- Parameters:
compound- Item CompoundTag.id- ID of the item.damage- Damage amount.components- Item components.from- Version specified in compound.to- Version to convert.
-
resolveItem
@Deprecated(since="1.5.14", forRemoval=true) public void resolveItem(Object compound, String material, Object components, float from, float to) Deprecated, for removal: This API element is subject to removal in a future version.Resolver current item compound with new material to set.- Parameters:
compound- Item CompoundTag.material- Material to set.components- Item components.from- Version specified in compound.to- Version to convert.
-
setDamage
@Deprecated(since="1.5.14", forRemoval=true) public void setDamage(Object compound, Object components, int damage, float from, float to) Deprecated, for removal: This API element is subject to removal in a future version.Set item damage depending on item version, this method removes old damage tag if the conversion is across legacy-flat.- Parameters:
compound- Item CompoundTag.components- Item components.damage- Damage amount to set.from- Version specified in compoundto- Version to convert.
-
getDamage
@Deprecated(since="1.5.14", forRemoval=true) public int getDamage(Object compound, Object components, float version) Deprecated, for removal: This API element is subject to removal in a future version.Get current item damage depending on item version.- Parameters:
compound- Item CompoundTag.components- Item components.version- Version of the item.- Returns:
- A integer representing item damage.
-
getEggEntity
@Deprecated(since="1.5.14", forRemoval=true) public String getEggEntity(Object compound, float version) Deprecated, for removal: This API element is subject to removal in a future version.Get current item entity, method for legacy SPAWN_EGG items.- Parameters:
compound- Item CompoundTag.version- Item version- Returns:
- A string representing entity id.
-
translate
@Deprecated(since="1.5.14", forRemoval=true) public String translate(String material, float from, float to) Deprecated, for removal: This API element is subject to removal in a future version.Translate given material and version pair into current server version.- Parameters:
material- Material to translate.from- Version specified in compoundto- Version to convert.- Returns:
- A string representing current server version material.
-