Items
Vanilla items and custom items from all plugins supported by Mimic. Get it via Mimic.items. To make your own plugin's items available here, implement ItemProvider instead.
Quick start
Key excalibur = Key.key("mmoitems:sword/excalibur");
// Check the ID read from a config
if (!items.hasItem(excalibur)) { ... }
// Create an item for the player
ItemStack sword = items.createItem(excalibur, 1, player);
// Identify an item
if (items.isItem(player.getInventory().getItemInMainHand(), excalibur)) { ... }IDs
Items are identified by Key, which consists of a namespace and a path:
The namespace is the ID of the plugin providing the item:
minecraft,mmoitems,craftengine.The path is the item within that plugin:
diamond,sword/excalibur,default/palm_log.
The namespace is required, there is no search over all plugins. Note that Key.key("excalibur") turns into minecraft:excalibur, so validate item IDs read from configs with hasItem or against getAllItems.
Ownership
An item belongs to the plugin with the highest priority that recognizes it, and vanilla items belong to minecraft. So a custom item is never recognized as the vanilla item it is built on: a ruby built on a diamond is not minecraft:diamond. To check the vanilla item regardless of plugins, use ItemStack.getType.
Rules
createItem must be called on the main thread, other methods may be called from any thread.
Item IDs may be unknown until their plugins finish loading, and may change when a plugin reloads. Don't validate configs in
onLoad, and don't keep created stacks across reloads.nullorfalsemeans "not possible": the item doesn't exist, no plugin recognizes it, or the payload is invalid.
Since
0.11.0
Functions
Returns IDs of all items of all providers. Use it for config validation and tab completion. IDs are sorted by provider priority, then in the order the provider returns them.