ItemProvider
Implement it to make your plugin's items available via Items. Register it in onLoad via Mimic.registerItemProvider. To create or identify items, use Items instead.
IDs
Mimic adds your provider id as the namespace, so receive and return IDs without it: ruby_sword becomes myplugin:ruby_sword. Don't change id later, it breaks consumers' configs.
If your plugin has its own namespaced IDs, convert them to paths:
Drop your plugin's own namespace:
myplugin:ruby_sword->ruby_sword.Keep other namespaces as the first path part:
default:palm_log->default/palm_log.
Other rules:
Allowed characters:
a-z,0-9,.,_,-and/. Items with other characters are ignored.To convert other IDs, lowercase them and replace other characters with
_. Keep a map back to the original IDs.If two IDs become the same (
Ruby_Swordandruby_sword), log a warning and keep one of them.
Ownership
An item belongs to the provider with the highest priority that returns an ID for it. So return an ID only for your items, and null for the rest, including the vanilla items your items are built on. Vanilla items belong to Mimic's own minecraft provider, which is always asked last.
Rules
Never throw. Return
nullinstead.Item IDs may be unknown until your plugin loads its data. Return
nullfor them until then.allItems, hasItem and getItemId may be called from any thread, createItem is called on the main thread.
Document the format of the payload your provider takes, or that it takes none.
Mimic does the rest: selects the provider by the item ID namespace, finds the owner of an item, compares items by ID, limits the amount of the created stack, and catches errors thrown by the provider.
Since
0.11.0
Properties
Inherited properties
Functions
Creates a new stack of the item with itemId. The caller owns the returned stack, so never return a shared one.