Class SubFixedItemInvView

java.lang.Object
alexiil.mc.lib.attributes.item.impl.AbstractPartialFixedItemInvView
alexiil.mc.lib.attributes.item.impl.SubFixedItemInvView
All Implemented Interfaces:
Convertible, AbstractItemInvView, FixedItemInvView
Direct Known Subclasses:
SubFixedItemInv

public class SubFixedItemInvView extends AbstractPartialFixedItemInvView
Default implementation for FixedItemInvView.getSubInv(int, int).
  • Field Details

    • fromIndex

      protected final int fromIndex
      The slots that we use.
    • toIndex

      protected final int toIndex
      The slots that we use.
  • Constructor Details

    • SubFixedItemInvView

      public SubFixedItemInvView(FixedItemInvView inv, int fromIndex, int toIndex)
  • Method Details

    • getInternalSlot

      protected final int getInternalSlot(int slot)
      Specified by:
      getInternalSlot in class AbstractPartialFixedItemInvView
      Returns:
      The slot that the internal AbstractPartialFixedItemInvView.inv should use.
    • getSlotCount

      public int getSlotCount()
      Returns:
      The number of slots in this inventory.
    • getFixedView

      public FixedItemInvView getFixedView()
      Returns:
      An object that only implements FixedItemInvView, and does not expose the modification methods that FixedItemInv does. Implementations that don't expose any modification methods themselves should override this method to just return themselves.
    • getSubInv

      public FixedItemInvView getSubInv(int fIndex, int tIndex)
      Description copied from interface: FixedItemInvView
      Equivalent to List.subList(int, int).
      Parameters:
      fIndex - The first slot to expose
      tIndex - The slot after the last slot to expose.
      Returns:
      a view of this inventory that only exposes the given number of slots. Might return "this" if fromIndex is 0 and toIndex is equal to FixedItemInvView.getSlotCount().
    • getMappedInv

      public FixedItemInvView getMappedInv(int... slots)
      Parameters:
      slots - The slots to expose.
      Returns:
      a view of this inventory that only exposes the given slots. Might return "this" if the slot array is just [0,1, ... FixedItemInvView.getSlotCount()-1]