Package noppes.npcs.api.handler
Interface ILinkedItemHandler
-
public interface ILinkedItemHandlerHandles registration and retrieval of linked items. Linked items are custom item definitions that can be updated globally.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidadd(ILinkedItem linkedItem)Registers a linked item with this handler.booleancontains(int id)Checks whether a linked item with the given ID exists.booleancontains(ILinkedItem linkedItem)Checks whether the given linked item is registered.ILinkedItemcreateItem(String name)Creates a new linked item with the given name.IItemStackcreateItemStack(int id)Creates an ItemStack from a linked item by its ID.ILinkedItemget(int id)Returns the linked item with the given ID.ILinkedItemremove(int id)Removes and returns the linked item with the given ID.
-
-
-
Method Detail
-
createItem
ILinkedItem createItem(String name)
Creates a new linked item with the given name.- Parameters:
name- the item name.- Returns:
- the created linked item.
-
createItemStack
IItemStack createItemStack(int id)
Creates an ItemStack from a linked item by its ID.- Parameters:
id- the linked item ID.- Returns:
- the item stack, or null if the ID is invalid.
-
add
void add(ILinkedItem linkedItem)
Registers a linked item with this handler.- Parameters:
linkedItem- the linked item to add.
-
remove
ILinkedItem remove(int id)
Removes and returns the linked item with the given ID.- Parameters:
id- the linked item ID.- Returns:
- the removed linked item, or null if not found.
-
get
ILinkedItem get(int id)
Returns the linked item with the given ID.- Parameters:
id- the linked item ID.- Returns:
- the linked item, or null if not found.
-
contains
boolean contains(int id)
Checks whether a linked item with the given ID exists.- Parameters:
id- the linked item ID.- Returns:
- true if it exists; false otherwise.
-
contains
boolean contains(ILinkedItem linkedItem)
Checks whether the given linked item is registered.- Parameters:
linkedItem- the linked item to check.- Returns:
- true if it exists; false otherwise.
-
-