Class IEffectMirror
java.lang.Object
com.saicone.rtag.item.mirror.IEffectMirror
- All Implemented Interfaces:
ItemMirror
IEffectMirror class to convert item effect format across versions.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an IEffectMirror for current server instance version.IEffectMirror(float version) Deprecated, for removal: This API element is subject to removal in a future version.IEffectMirror(@NotNull com.saicone.rtag.util.MC version) Constructs an IEffectMirror with specified server version to generate map names.IEffectMirror(@NotNull String fromId, @NotNull String toId, @NotNull String fromDuration, @NotNull String toDuration) Constructs an IEffectMirror with specified key names. -
Method Summary
Modifier and TypeMethodDescriptionvoiddowngrade(@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.getEffectId(@NotNull String key) Get potion effect id by key.getEffectKey(int id) Get potion effect key by id.@NotNull com.saicone.rtag.util.MCGet the minimum compatible version, inclusive.voidProcess current potion effects inside tag.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, downgrade, getDeprecationVersion, getMaximumVersion, getMinVersion0, upgrade, upgrade, upgrade
-
Constructor Details
-
IEffectMirror
public IEffectMirror()Constructs an IEffectMirror for current server instance version. -
IEffectMirror
Deprecated, for removal: This API element is subject to removal in a future version.Constructs an IEffectMirror with specified server version to generate map names.- Parameters:
version- The server version to create keys for.
-
IEffectMirror
-
IEffectMirror
public IEffectMirror(@NotNull @NotNull String fromId, @NotNull @NotNull String toId, @NotNull @NotNull String fromDuration, @NotNull @NotNull String toDuration) Constructs an IEffectMirror with specified key names.- Parameters:
fromId- Effect ID key to get.toId- Effect ID key to set.fromDuration- Effect duration key to get.toDuration- Effect duration key to set.
-
-
Method Details
-
getMinimumVersion
Description copied from interface:ItemMirrorGet the minimum compatible version, inclusive.- Specified by:
getMinimumVersionin interfaceItemMirror- Returns:
- a version.
-
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 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.
-
processEffects
@Internal public void processEffects(@NotNull @NotNull Object tag, @NotNull @NotNull String fromKey, @NotNull @NotNull String toKey, boolean useKey) Process current potion effects inside tag.- Parameters:
tag- ItemStack tag.fromKey- The initial key to read effects.toKey- The final key to save effects.useKey- true to convert effect ids to namespaced key.
-
getEffectKey
-
getEffectId
-