Class IDisplayMirror

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

public class IDisplayMirror extends Object implements ItemMirror
IDisplayMirror class to convert item display across versions.
  • Constructor Details

    • IDisplayMirror

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

      public IDisplayMirror(boolean convertName)
      Constructs an IDisplayMirror with specified name conversion option.
      Parameters:
      convertName - true to convert names between versions.
  • 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.
    • 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.
    • processLore

      @Internal public void processLore(@Nullable @Nullable Object display, boolean toJson)
      Process current display lore tag.
      Parameters:
      display - Display tag.
      toJson - True to convert texts into Json component.
    • processName

      @Internal public boolean processName(@Nullable @Nullable Object display, boolean toJson)
      Process current display name tag.
      Parameters:
      display - Display tag.
      toJson - True to convert texts into Json component.
      Returns:
      true if the display tag was processed.
    • processTag

      @Nullable @Internal public @Nullable Object processTag(@Nullable @Nullable Object tag, boolean toJson)
      Process current NBT tag that contains text inside.
      Parameters:
      tag - StringTag instance.
      toJson - True to convert text into Json component.
      Returns:
      A new tag with converted text value.
    • processString

      @Nullable @Internal public @Nullable Object processString(@Nullable @Nullable String string, boolean toJson)
      Process current text and convert into Json component or not.
      Parameters:
      string - Text to convert.
      toJson - True to convert text into Json component.
      Returns:
      A new converted text.