public interface SlotIterator
horizontally
or vertically.| Modifier and Type | Interface and Description |
|---|---|
static class |
SlotIterator.Type
the iterate type of the inventory.
|
| 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.
|
default @NotNull SlotIterator |
blacklist(@NotNull SlotPos slotPos)
blacklists the given slot position.
|
default @NotNull SlotIterator |
blacklistPattern(@NotNull Pattern<Boolean> pattern)
this method has the inverse effect of
withPattern(Pattern), where the other method would only allow the
iterator to go, this method prohibits this slots to iterate over. |
@NotNull SlotIterator |
blacklistPattern(@NotNull Pattern<Boolean> pattern,
int rowOffset,
int columnOffset)
This method has the inverse effect of
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.
|
default @NotNull SlotIterator |
endPosition(@NotNull SlotPos endPosition)
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.
|
default @NotNull SlotIterator |
withPattern(@NotNull Pattern<Boolean> pattern)
setting a pattern using this method will use it as a guideline where the slot iterator can set icons or not.
|
@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.
|
@NotNull default @NotNull SlotIterator blacklist(@NotNull @NotNull SlotPos slotPos)
Blacklisting a slot will make the iterator skip the given slot and directly go to the next un-blacklisted slot.
slotPos - the slot to blacklist.this, for chained calls.@NotNull default @NotNull SlotIterator endPosition(@NotNull @NotNull SlotPos endPosition)
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.
endPosition - the slot where the iterator should end.this, for chained calls.@NotNull default @NotNull SlotIterator withPattern(@NotNull @NotNull Pattern<Boolean> pattern)
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.
pattern - the pattern to use as a guideline.this, for chained calls.@NotNull default @NotNull SlotIterator blacklistPattern(@NotNull @NotNull Pattern<Boolean> pattern)
withPattern(Pattern), where the other method would only allow the
iterator to go, this method prohibits this slots to iterate over.pattern - the pattern where the slot iterator cannot iterate.this, for chained calls.@NotNull @NotNull Optional<Icon> get()
@NotNull @NotNull SlotIterator set(@NotNull @NotNull Icon icon)
icon - the new icon.this, for chained calls.@NotNull @NotNull SlotIterator previous()
this has no effect if the cursor is already at the first position of the inventory.
this, for chained calls.@NotNull @NotNull SlotIterator next()
this has no effect if the cursor is already at the last position of the inventory.
this, for chained calls.@NotNull @NotNull SlotIterator blacklist(int index)
blacklisting a slot will make the iterator skip the given slot and directly go to the next un-blacklisted slot.
index - the index to blacklist.this, for chained calls.@NotNull @NotNull SlotIterator blacklist(int row, int column)
blacklisting a slot will make the iterator skip the given slot and directly go to the next un-blacklisted slot.
row - the row of the slot to blacklist.column - the column of the slot to blacklist.this, for chained calls.int row()
@NotNull @NotNull SlotIterator row(int row)
row - the new row.this, for chained calls.int column()
@NotNull @NotNull SlotIterator column(int column)
column - the new column.this, for chained calls.@NotNull @NotNull SlotIterator reset()
when the iterator gets reset to its original position, started gets set back to false.
this, for chained calls.boolean started()
an iterator is not started until any
of previous() or next()
methods have been called.
true if this iterator has been started.boolean ended()
an iterator is not ended until it has reached the last slot of the inventory.
true if this iterator has been ended.@NotNull @NotNull SlotIterator endPosition(int row, int column)
if 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.
row - the row where the iterator should end.column - the column where the iterator should end.this, for chained calls.boolean doesAllowOverride()
- 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.
true if this iterator allows to override.@NotNull @NotNull SlotIterator allowOverride(boolean override)
- 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.
override - the value of the allow override option.this, for chained calls.@NotNull @NotNull SlotIterator withPattern(@NotNull @NotNull Pattern<Boolean> pattern, int rowOffset, int columnOffset)
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.
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.this, for chained calls.@NotNull @NotNull SlotIterator blacklistPattern(@NotNull @NotNull Pattern<Boolean> pattern, int rowOffset, int columnOffset)
withPattern(Pattern, int, int),
where the other method would only allow the iterator to go,
this method prohibits this slots to iterate over.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.this, for chained calls.Copyright © 2021. All rights reserved.