Adding compat
Buzzy Beez has a small API for other mods. Everything is in the de.devin.cbbees.api package.
You register your code through CBBeesApi during mod setup. Only register it when your mod is loaded.
Custom storages
Section titled “Custom storages”Bees take building materials from inventories next to a Logistics Port. They can’t see items that are stored anywhere else, such as in a storage network.
Add a PortStorage for your storage, and bees will use it like a normal inventory. It can also ask your storage to craft items that are missing.
Register it in your mod setup:
CBBeesApi.registerPortStorage(MyStorage)CBBeesApi.registerPortStorage(MyStorage.INSTANCE);In your compat class:
- Implement
PortStoragefor the storage itself. - Implement
PortStorageProvider.find(level, pos, side). Return null for blocks that aren’t yours. - If your storage can craft, set
canCraft = trueand implementcraft.
Examples: MEPortStorage (AE2), RSPortStorage (Refined Storage)
Unplaceable blocks
Section titled “Unplaceable blocks”Some blocks can’t be placed straight from a schematic. For example, the parts of a formed multiblock only exist after the multiblock is formed. If bees place them one by one, the structure breaks.
Add a substitute. It tells bees to place a different block instead, such as the unformed block. It can also run a finish action after the whole schematic is built, for example to form the multiblock again.
Register it in your mod setup:
CBBeesApi.registerSchematicSubstitute(MySubstitute)CBBeesApi.registerSchematicSubstitute(MySubstitute.INSTANCE);In your compat class:
- Implement
SchematicSubstitute. Return null for blocks that aren’t yours. - Return a
Substitutewith the block state bees should place. - If something has to happen after the build, pass a
finishaction.
Example: MultiblockSchematics (Immersive Engineering)
Custom rotation
Section titled “Custom rotation”When a schematic is rotated or mirrored, vanilla turns blocks that use the standard facing properties. If your block stores its direction another way, it ends up facing the wrong way.
Add a transform. It gets each block state before vanilla does, so you can rotate or mirror it yourself.
Register it in your mod setup:
CBBeesApi.registerBlockTransform(MyTransform)CBBeesApi.registerBlockTransform(MyTransform.INSTANCE);In your compat class:
- Implement
BlockTransformwithrotateandmirror. - Return null from both for blocks that aren’t yours.
Example: RefinedStorageSchematics (Refined Storage)
Custom bee actions
Section titled “Custom bee actions”Queued bee tasks and the undo history are saved with the world. Bees only know how to save their own actions. If one of your actions is queued, for example a substitute’s finish, saving fails.
Add a codec. It tells bees how to save and load your action.
Register it in your mod setup:
CBBeesApi.registerBeeAction(MyAction.Codec)CBBeesApi.registerBeeAction(MyAction.Codec.INSTANCE);In your compat class:
- Implement
BeeActionCodecwithsaveandload. - Start the
idwith your mod id, so it can’t clash with other mods.
Example: FormMultiblockAction.Codec (Immersive Engineering)