I - The type of the item (e.g. Integer)S - The type of the item stack (e.g. LegacyItemStack)public class ItemRegistry<I,S extends AItemStack<I,S>>
extends java.lang.Object
| Constructor and Description |
|---|
ItemRegistry(java.util.function.BiFunction<ItemRegistry<I,S>,I,S> createItemStack) |
| Modifier and Type | Method and Description |
|---|---|
java.util.List<I> |
byType(ItemType type)
Get a list of items which have the given type.
|
S |
create(I item)
Create a new item stack.
|
S |
create(I item,
int count)
Create a new item stack.
|
S |
create(I item,
int count,
net.lenni0451.mcstructs.nbt.tags.CompoundTag tag)
Create a new item stack.
|
S |
create(I item,
int count,
int damage)
Create a new item stack.
|
S |
create(I item,
int count,
int damage,
net.lenni0451.mcstructs.nbt.tags.CompoundTag tag)
Create a new item stack.
|
S |
empty() |
ItemMeta |
getMeta(I item)
Get or create the meta of an item.
|
I |
requireByType(ItemType type)
Get a required item by its type.
|
java.util.List<I> |
requireByType(ItemType type,
int maxCount)
Get a required list of items with the given type.
|
public ItemRegistry(java.util.function.BiFunction<ItemRegistry<I,S>,I,S> createItemStack)
public ItemMeta getMeta(I item)
item - The itempublic java.util.List<I> byType(ItemType type)
type - The typepublic I requireByType(ItemType type)
type - The typejava.lang.IllegalArgumentException - If there are more than one item or no items with the given typepublic java.util.List<I> requireByType(ItemType type, int maxCount)
type - The typemaxCount - The maximum count of itemspublic S empty()
public S create(I item)
item - The itempublic S create(I item, int count)
item - The itemcount - The countpublic S create(I item, int count, int damage)
item - The itemcount - The countdamage - The damagepublic S create(I item, int count, net.lenni0451.mcstructs.nbt.tags.CompoundTag tag)
item - The itemcount - The counttag - The Nbt tag