public final class BasicSlotIterator extends Object implements SlotIterator
SlotIterator.SlotIterator.Type| Constructor and Description |
|---|
BasicSlotIterator(@NotNull InventoryContents contents,
SlotIterator.Type type)
ctor.
|
BasicSlotIterator(@NotNull InventoryContents contents,
SlotIterator.Type type,
int startRow,
int startColumn)
ctor.
|
| Modifier and Type | Method and Description |
|---|---|
@NotNull SlotIterator |
allowOverride(boolean override)
sets the value of the allow override option.
|
@NotNull SlotIterator |
blacklist(int index)
blacklists the given slot index.
|
@NotNull SlotIterator |
blacklist(int row,
int column)
blacklists the given slot position.
|
@NotNull SlotIterator |
blacklistPattern(@NotNull Pattern<Boolean> pattern,
int rowOffset,
int columnOffset)
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. |
int |
column()
gets the current column of the iterator.
|
@NotNull SlotIterator |
column(int column)
sets the current column of the iterator.
|
boolean |
doesAllowOverride()
gets the value of the allow override option.
|
boolean |
ended()
checks if this iterator has been ended.
|
@NotNull SlotIterator |
endPosition(int row,
int column)
sets the slot where the iterator should end.
|
@NotNull Optional<Icon> |
get()
gets the icon at the current position in the inventory.
|
@NotNull SlotIterator |
next()
moves the cursor to the next position inside the inventory.
|
@NotNull SlotIterator |
previous()
moves the cursor to the previous position inside the inventory.
|
@NotNull SlotIterator |
reset()
resets iterator to its original position specified while creation.
|
int |
row()
gets the current row of the iterator.
|
@NotNull SlotIterator |
row(int row)
sets the current row of the iterator.
|
@NotNull SlotIterator |
set(@NotNull Icon icon)
replaces the icon at the current position in the inventory by the given icon.
|
boolean |
started()
checks if this iterator has been started.
|
@NotNull SlotIterator |
withPattern(@NotNull Pattern<Boolean> pattern,
int rowOffset,
int columnOffset)
setting a pattern using this method will use it as a guideline where the slot iterator can set icons or not.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitblacklist, blacklistPattern, endPosition, withPatternpublic BasicSlotIterator(@NotNull
@NotNull InventoryContents contents,
@NotNull
SlotIterator.Type type)
contents - the contents.type - the type.public BasicSlotIterator(@NotNull
@NotNull InventoryContents contents,
@NotNull
SlotIterator.Type type,
int startRow,
int startColumn)
contents - the contents.type - the type.startRow - the start row.startColumn - the start column.@NotNull public @NotNull Optional<Icon> get()
SlotIteratorget in interface SlotIterator@NotNull public @NotNull SlotIterator set(@NotNull @NotNull Icon icon)
SlotIteratorset in interface SlotIteratoricon - the new icon.this, for chained calls.@NotNull public @NotNull SlotIterator previous()
SlotIteratorthis has no effect if the cursor is already at the first position of the inventory.
previous in interface SlotIteratorthis, for chained calls.@NotNull public @NotNull SlotIterator next()
SlotIteratorthis has no effect if the cursor is already at the last position of the inventory.
next in interface SlotIteratorthis, for chained calls.@NotNull public @NotNull SlotIterator blacklist(int index)
SlotIteratorblacklisting a slot will make the iterator skip the given slot and directly go to the next un-blacklisted slot.
blacklist in interface SlotIteratorindex - the index to blacklist.this, for chained calls.@NotNull public @NotNull SlotIterator blacklist(int row, int column)
SlotIteratorblacklisting a slot will make the iterator skip the given slot and directly go to the next un-blacklisted slot.
blacklist in interface SlotIteratorrow - the row of the slot to blacklist.column - the column of the slot to blacklist.this, for chained calls.public int row()
SlotIteratorrow in interface SlotIterator@NotNull public @NotNull SlotIterator row(int row)
SlotIteratorrow in interface SlotIteratorrow - the new row.this, for chained calls.public int column()
SlotIteratorcolumn in interface SlotIterator@NotNull public @NotNull SlotIterator column(int column)
SlotIteratorcolumn in interface SlotIteratorcolumn - the new column.this, for chained calls.@NotNull public @NotNull SlotIterator reset()
SlotIterator
when the iterator gets reset to its original position, started gets set back to false.
reset in interface SlotIteratorthis, for chained calls.public boolean started()
SlotIterator
an iterator is not started until any
of SlotIterator.previous() or SlotIterator.next()
methods have been called.
started in interface SlotIteratortrue if this iterator has been started.public boolean ended()
SlotIteratoran iterator is not ended until it has reached the last slot of the inventory.
ended in interface SlotIteratortrue if this iterator has been ended.@NotNull public @NotNull SlotIterator endPosition(int row, int column)
SlotIteratorif the row is a negative value, it is set to the maximum row count.
if the column is a negative value, it is set to maximum column count.
endPosition in interface SlotIteratorrow - the row where the iterator should end.column - the column where the iterator should end.this, for chained calls.public boolean doesAllowOverride()
SlotIterator
- if this is true, the iterator will override any
existing icon it founds on its way.
- if this is false, the iterator will skip
the slots which are not empty.
doesAllowOverride in interface SlotIteratortrue if this iterator allows to override.@NotNull public @NotNull SlotIterator allowOverride(boolean override)
SlotIterator
- if this is true, the iterator will override any
existing icon it founds on its way.
- if this is false, the iterator will skip
the slots which are not empty.
allowOverride in interface SlotIteratoroverride - the value of the allow override option.this, for chained calls.@NotNull public @NotNull SlotIterator withPattern(@NotNull @NotNull Pattern<Boolean> pattern, int rowOffset, int columnOffset)
SlotIteratorwrapAround 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.
withPattern in interface SlotIteratorpattern - 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.this, for chained calls.@NotNull public @NotNull SlotIterator blacklistPattern(@NotNull @NotNull Pattern<Boolean> pattern, int rowOffset, int columnOffset)
SlotIteratorSlotIterator.withPattern(Pattern, int, int),
where the other method would only allow the iterator to go,
this method prohibits this slots to iterate over.blacklistPattern in interface SlotIteratorpattern - 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.this, for chained calls.Copyright © 2021. All rights reserved.