Class IPotionMirror

java.lang.Object
com.saicone.rtag.item.mirror.IPotionMirror
All Implemented Interfaces:
ItemMirror

public class IPotionMirror extends Object implements ItemMirror
IPotionMirror to convert item potions across 1.8 and other versions.
Mojang removes potion types inside item damage since 1.9, this class provides a clear conversion.
  • Constructor Details

    • IPotionMirror

      public IPotionMirror()
      Constructs an IPotionMirror with default options.
    • IPotionMirror

      public IPotionMirror(boolean convertDamage)
      Constructs an IPotionMirror with specified damage conversion option.
      Parameters:
      convertDamage - true to convert old potion damage into potion effect.
  • Method Details

    • getMaximumVersion

      @NotNull public @NotNull com.saicone.rtag.util.MC getMaximumVersion()
      Description copied from interface: ItemMirror
      Get the maximum compatible version, exclusive.
      Specified by:
      getMaximumVersion in interface ItemMirror
      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: ItemMirror
      Upgrade current item tag compound from lower version.
      Specified by:
      upgrade in interface ItemMirror
      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.
    • 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: ItemMirror
      Upgrade current item tag compound from lower version.
      Specified by:
      upgrade in interface ItemMirror
      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.
    • 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: ItemMirror
      Downgrade current item tag compound from upper version.
      Specified by:
      downgrade in interface ItemMirror
      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.
    • getPotion

      @Internal public String getPotion(int damage)
      Get potion name from 1.8 damage.
      Parameters:
      damage - Potion item damage.
      Returns:
      A potion name.
    • getDamage

      @Internal public int getDamage(String id, String potion)
      Get corresponding damage to 1.8 item from potion name.
      Parameters:
      id - Item material ID.
      potion - Potion name.
      Returns:
      A item damage number.