Class SlotIterator.Impl

java.lang.Object
dev.aurelium.slate.inv.content.SlotIterator.Impl
All Implemented Interfaces:
SlotIterator
Enclosing interface:
SlotIterator

public static class SlotIterator.Impl extends Object implements SlotIterator
  • Constructor Details

  • Method Details

    • get

      public Optional<ClickableItem> get()
      Description copied from interface: SlotIterator
      Gets the item at the current position in the inventory.
      Specified by:
      get in interface SlotIterator
      Returns:
      the item at the current position
    • set

      public SlotIterator set(ClickableItem item)
      Description copied from interface: SlotIterator
      Replaces the item at the current position in the inventory by the given item.
      Specified by:
      set in interface SlotIterator
      Parameters:
      item - the new item
      Returns:
      this, for chained calls
    • previous

      public SlotIterator previous()
      Description copied from interface: SlotIterator
      Moves the cursor to the previous position inside the inventory.
      This has no effect if the cursor is already at the first position of the inventory.
      Specified by:
      previous in interface SlotIterator
      Returns:
      this, for chained calls
    • next

      public SlotIterator next()
      Description copied from interface: SlotIterator
      Moves the cursor to the next position inside the inventory.
      This has no effect if the cursor is already at the last position of the inventory.
      Specified by:
      next in interface SlotIterator
      Returns:
      this, for chained calls
    • blacklist

      public SlotIterator blacklist(int index)
      Description copied from interface: SlotIterator
      Blacklists the given slot index.
      Blacklisting a slot will make the iterator skip the given slot and directly go to the next unblacklisted slot.
      Specified by:
      blacklist in interface SlotIterator
      Parameters:
      index - the index to blacklist
      Returns:
      this, for chained calls
    • blacklist

      public SlotIterator blacklist(int row, int column)
      Description copied from interface: SlotIterator
      Blacklists the given slot position.
      Blacklisting a slot will make the iterator skip the given slot and directly go to the next unblacklisted slot.
      Specified by:
      blacklist in interface SlotIterator
      Parameters:
      row - the row of the slot to blacklist
      column - the column of the slot to blacklist
      Returns:
      this, for chained calls
    • blacklist

      public SlotIterator blacklist(SlotPos slotPos)
      Description copied from interface: SlotIterator
      Blacklists the given slot position.
      Blacklisting a slot will make the iterator skip the given slot and directly go to the next unblacklisted slot.
      Specified by:
      blacklist in interface SlotIterator
      Parameters:
      slotPos - the slot to blacklist
      Returns:
      this, for chained calls
    • row

      public int row()
      Description copied from interface: SlotIterator
      Gets the current row of the iterator.
      Specified by:
      row in interface SlotIterator
      Returns:
      the current row
    • row

      public SlotIterator row(int row)
      Description copied from interface: SlotIterator
      Sets the current row of the iterator.
      Specified by:
      row in interface SlotIterator
      Parameters:
      row - the new row
      Returns:
      this, for chained calls
    • column

      public int column()
      Description copied from interface: SlotIterator
      Gets the current column of the iterator.
      Specified by:
      column in interface SlotIterator
      Returns:
      the current column
    • column

      public SlotIterator column(int column)
      Description copied from interface: SlotIterator
      Sets the current column of the iterator.
      Specified by:
      column in interface SlotIterator
      Parameters:
      column - the new column
      Returns:
      this, for chained calls
    • reset

      public SlotIterator reset()
      Description copied from interface: SlotIterator
      Resets iterator to its original position specified while creation.
      When the iterator gets reset to its original position, started gets set back to false
      Specified by:
      reset in interface SlotIterator
      Returns:
      this, for chained calls
    • started

      public boolean started()
      Description copied from interface: SlotIterator
      Checks if this iterator has been started.
      An iterator is not started until any of the SlotIterator.previous() or the SlotIterator.next() methods have been called.
      Specified by:
      started in interface SlotIterator
      Returns:
      true if this iterator has been started
    • ended

      public boolean ended()
      Description copied from interface: SlotIterator
      Checks if this iterator has been ended.
      An iterator is not ended until it has reached the last slot of the inventory.
      Specified by:
      ended in interface SlotIterator
      Returns:
      true if this iterator has been ended
    • endPosition

      public SlotIterator endPosition(int row, int column)
      Description copied from interface: SlotIterator
      Sets the slot where the iterator should end.

      If row is a negative value, it is set to the maximum row count.
      If column is a negative value, it is set to maximum column count.
      Specified by:
      endPosition in interface SlotIterator
      Parameters:
      row - The row where the iterator should end
      column - The column where the iterator should end
      Returns:
      this, for chained calls
    • endPosition

      public SlotIterator endPosition(SlotPos endPosition)
      Description copied from interface: SlotIterator
      Sets the slot where the iterator should end.

      If the row of the SlotPos is a negative value, it is set to the maximum row count.
      If the column of the SlotPos is a negative value, it is set to maximum column count.
      Specified by:
      endPosition in interface SlotIterator
      Parameters:
      endPosition - The slot where the iterator should end
      Returns:
      this, for chained calls
    • doesAllowOverride

      public boolean doesAllowOverride()
      Description copied from interface: SlotIterator
      Gets the value of the allow override option.
      - If this is true, the iterator will override any existing item it founds on its way.
      - If this is false, the iterator will skip the slots which are not empty.
      Specified by:
      doesAllowOverride in interface SlotIterator
      Returns:
      true if this iterator allows to override
    • allowOverride

      public SlotIterator allowOverride(boolean override)
      Description copied from interface: SlotIterator
      Sets the value of the allow override option.
      - If this is true, the iterator will override any existing item it founds on its way.
      - If this is false, the iterator will skip the slots which are not empty.
      Specified by:
      allowOverride in interface SlotIterator
      Parameters:
      override - the value of the allow override option
      Returns:
      this, for chained calls
    • withPattern

      public SlotIterator withPattern(Pattern<Boolean> pattern)
      Description copied from interface: SlotIterator
      Setting a pattern using this method will use it as a guideline where the slot iterator can set items or not. If the pattern doesn't fill the whole inventory, the slot iterator is limited to the space the pattern provides. If the pattern has the wrapAround flag set, then the iterator can iterate over the entire inventory, even if the pattern would not fill it by itself

      If the provided pattern has no default value set, this method will set it to false

      If you pass null into the pattern parameter, this functionality will be disabled and the iterator will continue to work as normal.
      Specified by:
      withPattern in interface SlotIterator
      Parameters:
      pattern - The pattern to use as a guideline
      Returns:
      this, for chained calls
    • withPattern

      public SlotIterator withPattern(Pattern<Boolean> pattern, int rowOffset, int columnOffset)
      Description copied from interface: SlotIterator
      Setting a pattern using this method will use it as a guideline where the slot iterator can set items or not. If the pattern doesn't fill the whole inventory, the slot iterator is limited to the space the pattern provides. If the pattern has the wrapAround flag set, then the iterator can iterate over the entire inventory, even if the pattern would not fill it by itself

      The offset defines the top-left corner of the pattern. If the wrapAround flag is set, then the entire pattern will be just shifted by the given amount.

      If the provided pattern has no default value set, this method will set it to false

      If you pass null into the pattern parameter, this functionality will be disabled and the iterator will continue to work as normal.
      Specified by:
      withPattern in interface SlotIterator
      Parameters:
      pattern - The pattern to use as a guideline
      rowOffset - The row offset from the top left corner
      columnOffset - The column offset from the top left corner
      Returns:
      this, for chained calls
    • blacklistPattern

      public SlotIterator blacklistPattern(Pattern<Boolean> pattern)
      Description copied from interface: SlotIterator
      This method has the inverse effect of SlotIterator.withPattern(Pattern), where the other method would only allow the iterator to go, this method prohibits this slots to iterate over
      Specified by:
      blacklistPattern in interface SlotIterator
      Parameters:
      pattern - The pattern where the slot iterator cannot iterate
      Returns:
      this, for chained calls
    • blacklistPattern

      public SlotIterator blacklistPattern(Pattern<Boolean> pattern, int rowOffset, int columnOffset)
      Description copied from interface: SlotIterator
      This method has the inverse effect of SlotIterator.withPattern(Pattern, int, int), where the other method would only allow the iterator to go, this method prohibits this slots to iterate over
      Specified by:
      blacklistPattern in interface SlotIterator
      Parameters:
      pattern - The pattern where the slot iterator cannot iterate
      rowOffset - The row offset from the top left corner
      columnOffset - The column offset from the top left corner
      Returns:
      this, for chained calls