Interface Mirror<Slot>

Type Parameters:
Slot - type of slot that this mirror works on
All Known Implementing Classes:
EnderChestMirror, PlayerInventoryMirror

public interface Mirror<Slot>
Represents a mirror that an inventory is viewed through. Mirrors provide the power change the positions of slots in the grid window. Hence, Mirrors only affect how players see the SpectatorInventory, they don't change the outcome of Inventory.getItem(int) and related methods.
See Also:
  • Method Details

    • getIndex

      Integer getIndex(Slot slot)
      Gets the index for the grid in which the slot is displayed. This method must satisfy the equation Objects.equals(index, getIndex(getSlot(index))).s
    • getSlot

      Slot getSlot(int index)
      Get the slot for the index at which the slot is displayed. This method must satisfy the equation Objects.equals(slot, getSlot(getIndex(slot))).
    • defaultPlayerInventory

      static Mirror<PlayerInventorySlot> defaultPlayerInventory()
      The default mirror which assigns each slot to its default index.
    • defaultEnderChest

      static Mirror<EnderChestSlot> defaultEnderChest()
      The default mirror which assigns each slot to its default index.
    • forInventory

      static Mirror<PlayerInventorySlot> forInventory(String template)
      Convert a template into a Mirror.
    • forEnderChest

      static Mirror<EnderChestSlot> forEnderChest(String template)
      Convert a template into a Mirror.
    • toInventoryTemplate

      static String toInventoryTemplate(Mirror<PlayerInventorySlot> mirror)
      Convert a Mirror into a template.
    • toEnderChestTemplate

      static String toEnderChestTemplate(Mirror<EnderChestSlot> mirror)
      Convert a Mirror into a template.