Package net.ess3.api
Interface IItemDb.ItemResolver
- All Known Implementing Classes:
CustomItemResolver
- Enclosing interface:
IItemDb
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public static interface IItemDb.ItemResolver
extends Function<String,ItemStack>
A service capable of resolving custom item names to items and vice versa, as well as adding extra item names to
tab complete suggestions.
-
Method Summary
Modifier and TypeMethodDescriptionCreates an item stack from the given name, if the given name is recognised by this resolver.default Collection
<String> getNames()
Get all possible names that are recognised by this item resolver.default String
Get a name recognised by this resolver for the given ItemStack, and return null if none was found.
-
Method Details
-
apply
Creates an item stack from the given name, if the given name is recognised by this resolver. -
getNames
Get all possible names that are recognised by this item resolver.Implementing this method is optional but recommended, since it enables custom items to be seen in tab complete.
- Returns:
- A collection of all the possible names for items that this resolver recognises.
-
serialize
Get a name recognised by this resolver for the given ItemStack, and return null if none was found. The implementation ofapply(String)
must recognise any string returned here. Note that if you return a string here, no extra meta will be added - if you want to add extra meta, you need to return it with your serialized string.Implementing this method is optional but recommended, since it enables custom items to be saved by /createkit.
- Parameters:
stack
- The stack to serialize- Returns:
- The name of the item if a suitable name was found, else null
-