BlockProvider
Implement it to make your plugin's blocks available via Blocks. Register it in onLoad via Mimic.registerBlockProvider. To get, set or break blocks, use Blocks instead.
IDs
Mimic adds your provider id as the namespace, so receive and return IDs without it: ruby_ore becomes myplugin:ruby_ore. Don't change id later, it breaks consumers' configs.
Block IDs are separate from item IDs: a block and the item placing it may have different IDs.
If your plugin has its own namespaced IDs, convert them to paths:
Drop your plugin's own namespace:
myplugin:ruby_ore->ruby_ore.Keep other namespaces as the first path part:
default:palm_log->default/palm_log.
Other rules:
Allowed characters:
a-z,0-9,.,_,-and/. Blocks 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_Oreandruby_ore), log a warning and keep one of them.
Ownership
A block belongs to the provider with the highest priority that returns an ID for it. So return an ID only for your blocks, and null for the rest, including the vanilla blocks your blocks are built on. Vanilla blocks belong to Mimic's own minecraft provider, which is always asked last.
Rules
Never throw. Return
nullfrom reads andfalsefrom changes instead.Fire no place or break events and make no protection checks, the caller is responsible for both.
Block IDs may be unknown until your plugin loads its data. Return
nullorfalsefor them until then.All methods are expected on the main thread (on Folia - on the thread owning the block), but Mimic doesn't enforce it.
Mimic does the rest: selects the provider by the block ID namespace, finds the owner of a block, checks that the block to set is empty, limits the amount of the created stack, and catches errors thrown by the provider.
Since
0.11.0
Properties
Inherited properties
Functions
Breaks the block and passes the dropped items to the dropsConsumer, then drops the items it returns on the ground near the block. Mimic calls it only for blocks this provider returns an ID for.
Creates a new stack of the item placing the block with blockId. The caller owns the returned stack, so never return a shared one. Some blocks, like fire, can't be placed by an item.
Returns ID of the block, or null if it isn't a block of this provider.
Returns ID of the block placed by the item, or null if the item doesn't place a block of this provider.