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 class Slot<T extends IInventory<I,S>,I,S extends net.lenni0451.mcstructs.items.AItemStack<I,S>>
extends java.lang.Object
| Constructor and Description |
|---|
Slot(IInventory<I,S> inventory,
int slotIndex,
int inventoryIndex,
java.util.function.BiFunction<Slot<T,I,S>,S,java.lang.Integer> acceptor)
Create a new slot.
|
| Modifier and Type | Method and Description |
|---|---|
static <T extends IInventory<I,S>,I,S extends net.lenni0451.mcstructs.items.AItemStack<I,S>> |
accept(int count)
Get a slot count function which accepts the given count of items.
|
static <T extends IInventory<I,S>,I,S extends net.lenni0451.mcstructs.items.AItemStack<I,S>> |
acceptAll()
Get a slot count function which accepts all items.
|
static <T extends IInventory<I,S>,I,S extends net.lenni0451.mcstructs.items.AItemStack<I,S>> |
acceptNone()
Get a slots count function which accepts no items.
|
boolean |
accepts(S stack)
Check if this slots accepts the given item stack.
|
int |
acceptsCount(S stack)
Get the max count of items this slot accepts.
|
static <T extends IInventory<I,S>,I,S extends net.lenni0451.mcstructs.items.AItemStack<I,S>> |
acceptTags(int maxCount,
net.lenni0451.mcstructs.items.info.ItemTag... tags)
Get a slot count function which accepts the given item tags with the given max count.
|
static <T extends IInventory<I,S>,I,S extends net.lenni0451.mcstructs.items.AItemStack<I,S>> |
acceptTags(net.lenni0451.mcstructs.items.info.ItemTag... tags)
Get a slot count function which accepts the given item tags.
|
static <T extends IInventory<I,S>,I,S extends net.lenni0451.mcstructs.items.AItemStack<I,S>> |
acceptTypes(int maxCount,
net.lenni0451.mcstructs.items.info.ItemType... types)
Get a slot count function which accepts the given item types with the given max count.
|
static <T extends IInventory<I,S>,I,S extends net.lenni0451.mcstructs.items.AItemStack<I,S>> |
acceptTypes(net.lenni0451.mcstructs.items.info.ItemType... types)
Get a slot count function which accepts the given item types.
|
boolean |
canTake(InventoryHolder<T,I,S> inventoryHolder)
Check if the given inventory holder can take the contents of this slot.
|
IInventory<I,S> |
getInventory()
Get the inventory of this slot.
|
int |
getInventoryIndex()
Get the inventory index of this slot.
|
int |
getSlotIndex()
Get the slot index of this slot.
|
S |
getStack() |
void |
onTake(InventoryHolder<T,I,S> inventoryHolder,
S stack)
Update the slot when an item stack is taken from this slot.
|
void |
onUpdate()
Update the inventory of this slot.
|
void |
setStack(S stack)
Set the item stack in this slot.
|
public Slot(IInventory<I,S> inventory, int slotIndex, int inventoryIndex, java.util.function.BiFunction<Slot<T,I,S>,S,java.lang.Integer> acceptor)
AContainer.addSlot(IInventory, int, BiFunction) instead.inventory - The inventoryslotIndex - The slot indexinventoryIndex - The inventory indexacceptor - The slot count functionpublic static <T extends IInventory<I,S>,I,S extends net.lenni0451.mcstructs.items.AItemStack<I,S>> java.util.function.BiFunction<Slot<T,I,S>,S,java.lang.Integer> acceptAll()
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 static <T extends IInventory<I,S>,I,S extends net.lenni0451.mcstructs.items.AItemStack<I,S>> java.util.function.BiFunction<Slot<T,I,S>,S,java.lang.Integer> acceptNone()
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 static <T extends IInventory<I,S>,I,S extends net.lenni0451.mcstructs.items.AItemStack<I,S>> java.util.function.BiFunction<Slot<T,I,S>,S,java.lang.Integer> accept(int count)
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)count - The count of itemspublic static <T extends IInventory<I,S>,I,S extends net.lenni0451.mcstructs.items.AItemStack<I,S>> java.util.function.BiFunction<Slot<T,I,S>,S,java.lang.Integer> acceptTypes(net.lenni0451.mcstructs.items.info.ItemType... types)
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)types - The item typespublic static <T extends IInventory<I,S>,I,S extends net.lenni0451.mcstructs.items.AItemStack<I,S>> java.util.function.BiFunction<Slot<T,I,S>,S,java.lang.Integer> acceptTypes(int maxCount, net.lenni0451.mcstructs.items.info.ItemType... types)
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)maxCount - The max count of itemstypes - The item typespublic static <T extends IInventory<I,S>,I,S extends net.lenni0451.mcstructs.items.AItemStack<I,S>> java.util.function.BiFunction<Slot<T,I,S>,S,java.lang.Integer> acceptTags(net.lenni0451.mcstructs.items.info.ItemTag... tags)
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)tags - The item tagspublic static <T extends IInventory<I,S>,I,S extends net.lenni0451.mcstructs.items.AItemStack<I,S>> java.util.function.BiFunction<Slot<T,I,S>,S,java.lang.Integer> acceptTags(int maxCount, net.lenni0451.mcstructs.items.info.ItemTag... tags)
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)maxCount - The max count of itemstags - The item tagspublic IInventory<I,S> getInventory()
public int getSlotIndex()
public int getInventoryIndex()
public S getStack()
public void setStack(S stack)
stack - The item stackpublic boolean accepts(S stack)
stack - The item stackpublic int acceptsCount(S stack)
stack - The item stackpublic boolean canTake(InventoryHolder<T,I,S> inventoryHolder)
inventoryHolder - The inventory holderpublic void onUpdate()
public void onTake(InventoryHolder<T,I,S> inventoryHolder, S stack)
inventoryHolder - The inventory holderstack - The item stack