Item manager

About Item manager.

Access the manager

To access item manager you can use:

CustomItemManager.getManager(); // Shortcut of second version.
// OR
Managers.getCustomItemManager();

About manager

Manager uses Optional for minimizing NullPointerException moments. If you don't know how Optional works in this page you gonna understand it.

Finding and getting the item

To get the CustomItem object you can use this:

CustomItemManager manager = CustomItemManager.getManager();
manager.customItem("ID").ifPresent((item) -> {
    // Some code
});
// OR
CustomItem item = manager.customItem("ID").orElse(null); // If you don't like lambda

If we talk about runtime object of custom items:

Creating ItemStack

To create ItemStack we need CustomItem object and manager:

Checking if item is custom

Register the item

Last updated