public class ItemManager extends FactoryManager<ItemManager,Item,ItemFactory>
| Modifier and Type | Class and Description |
|---|---|
class |
ItemManager.Init |
Manager.ManagerEvent<S>registry| Modifier and Type | Method and Description |
|---|---|
java.util.Optional<ItemFactory> |
get(java.lang.String name)
Gets an object by its registered name.
|
java.util.Optional<BlockFactory> |
getBlockFromItem(Item item) |
ItemFactory |
getItemFromBlock(BlockFactory block) |
void |
init()
Initializes the manager event
|
ItemFactory |
register(ItemFactory factory)
Register a new object construction factory.
|
ItemFactory |
register(java.lang.String id,
java.lang.Class<? extends Item> type)
Register a new item with custom constructor arguments.
|
ItemFactory |
register(java.lang.String id,
java.lang.Class<? extends Item> type,
java.util.function.Function<java.lang.Class<?>,java.util.Optional<?>> mapping)
Register a new item with custom constructor arguments.
|
ItemFactory |
register(java.lang.String id,
java.util.function.Supplier<Item> constructor)
Register a new item with custom constructor arguments.
|
public ItemFactory register(java.lang.String id, java.lang.Class<? extends Item> type, java.util.function.Function<java.lang.Class<?>,java.util.Optional<?>> mapping)
register in class FactoryManager<ItemManager,Item,ItemFactory>id - The item IDtype - The class of the itemmapping - The custom DI mappingpublic ItemFactory register(java.lang.String id, java.lang.Class<? extends Item> type)
register in class FactoryManager<ItemManager,Item,ItemFactory>id - The item IDtype - The class of the itempublic ItemFactory register(java.lang.String id, java.util.function.Supplier<Item> constructor)
register in class FactoryManager<ItemManager,Item,ItemFactory>id - The item IDconstructor - Item instance Supplierpublic ItemFactory register(ItemFactory factory)
FactoryManagerregister in class FactoryManager<ItemManager,Item,ItemFactory>factory - The construction factorypublic ItemFactory getItemFromBlock(BlockFactory block)
public java.util.Optional<BlockFactory> getBlockFromItem(Item item)
public java.util.Optional<ItemFactory> get(java.lang.String name)
FactoryManagerget in class FactoryManager<ItemManager,Item,ItemFactory>name - Registered namepublic void init()
Managerinit in class Manager<ItemManager>