T - The type of the inventory (e.g. IInventory)I - The type of the item (e.g. Integer)S - The type of the item stack (e.g. LegacyItemStack)public abstract class AContainer<T extends IInventory<I,S>,I,S extends net.lenni0451.mcstructs.items.AItemStack<I,S>>
extends java.lang.Object
| Constructor and Description |
|---|
AContainer(int windowId) |
| Modifier and Type | Method and Description |
|---|---|
protected Slot<T,I,S> |
addSlot(IInventory<I,S> inventory,
int inventoryIndex,
java.util.function.BiFunction<Slot<T,I,S>,S,java.lang.Integer> acceptor)
Add a slot to this container.
|
protected <SLOT extends Slot<T,I,S>> |
addSlot(java.util.function.IntFunction<SLOT> slotSupplier)
Add a custom slot to this container.
|
abstract S |
click(InventoryHolder<T,I,S> inventoryHolder,
int slotId,
int button,
InventoryAction action)
Handle a click in this container.
|
void |
close()
Handle the closing of this container.
|
Slot<T,I,S> |
getSlot(int index)
Get a slot by its index.
|
int |
getSlotCount() |
int |
getWindowId() |
protected abstract void |
initSlots()
Initialize all slots of this container.
|
protected abstract void initSlots()
public int getWindowId()
protected Slot<T,I,S> addSlot(IInventory<I,S> inventory, int inventoryIndex, java.util.function.BiFunction<Slot<T,I,S>,S,java.lang.Integer> acceptor)
inventory - The inventoryinventoryIndex - The index of the slot in the inventoryacceptor - The slot count functionprotected <SLOT extends Slot<T,I,S>> SLOT addSlot(java.util.function.IntFunction<SLOT> slotSupplier)
SLOT - The type of the slotslotSupplier - The slot supplierpublic Slot<T,I,S> getSlot(int index)
index - The index of the slotpublic int getSlotCount()
public abstract S click(InventoryHolder<T,I,S> inventoryHolder, int slotId, int button, InventoryAction action)
inventoryHolder - The inventory holderslotId - The slot idbutton - The buttonaction - The actionpublic void close()