@NonnullByDefault public class MenuPopulator extends Object
Gui| Modifier and Type | Field and Description |
|---|---|
protected List<Integer> |
remainingSlots |
| Constructor and Description |
|---|
MenuPopulator(Gui gui,
List<Integer> slots) |
MenuPopulator(Gui gui,
MenuScheme scheme) |
| Modifier and Type | Method and Description |
|---|---|
MenuPopulator |
accept(Item item)
Places an item onto the
Gui using the next available slot in the populator |
MenuPopulator |
acceptIfSpace(Item item)
Places an item onto the
Gui using the next available slot in the populator |
MenuPopulator |
consume(Consumer<Slot> action) |
MenuPopulator |
consumeIfSpace(Consumer<Slot> action) |
MenuPopulator |
copy() |
int |
getRemainingSpace()
Gets the number of remaining slots in the populator.
|
ImmutableList<Integer> |
getSlots()
Gets an immutable copy of the slots used by this populator.
|
boolean |
hasSpace()
Gets if there is any space left in this populator
|
boolean |
placeIfSpace(Item item)
Places an item onto the
Gui using the next available slot in the populator |
void |
reset()
Resets the slot order used by this populator to the state it was in upon construction
|
boolean |
tryConsume(Consumer<Slot> action) |
public MenuPopulator(Gui gui, MenuScheme scheme)
public ImmutableList<Integer> getSlots()
public void reset()
public MenuPopulator consume(Consumer<Slot> action)
public MenuPopulator consumeIfSpace(Consumer<Slot> action)
public MenuPopulator accept(Item item)
Gui using the next available slot in the populatoritem - the item to placeIllegalStateException - if there are not more slotspublic MenuPopulator acceptIfSpace(Item item)
Gui using the next available slot in the populatoritem - the item to placepublic boolean placeIfSpace(Item item)
Gui using the next available slot in the populatoritem - the item to placepublic int getRemainingSpace()
public boolean hasSpace()
public MenuPopulator copy()
Copyright © 2020. All rights reserved.