Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AddonAPIKit

Expose APIs from your Minecraft Bedrock addons so other addons can call into them.

AddonAPIKit builds on MCBE-IPC to provide a typed, request-response API layer over Minecraft's script event system. One addon defines named endpoints with typed parameters and return values; any other addon can call those endpoints by name and get results back asynchronously.

Installation

Manual

Download AddonAPIKit.js from the releases page and copy it into your addon's script directory. Import from it directly.

NPM

npm install @forestoflight/addonapikit

Quick example

// Server addon — expose a getCount endpoint
import { world } from '@minecraft/server';
import { AddonAPIServer, APIController, VoidModel, PROTO } from './AddonAPIKit.js';

const server = new AddonAPIServer('playerInfo', '1.0.0');
const controller = new APIController();
controller.addEndpoint('getCount', () => world.getPlayers().length, VoidModel, PROTO.Int32);
server.setupController(controller);
// Caller addon — call it from another addon
import { AddonAPICaller, VoidModel, PROTO } from './AddonAPIKit.js';

const playerInfoAPICaller = new AddonAPICaller('playerInfo', '1.0.0');
const count = await playerInfoAPICaller.call('playerInfo:getCount', VoidModel, undefined, PROTO.Int32);
console.log(`${count} players online`);

Guides

  • Publishing an API — define endpoints and expose them from your addon
  • Calling an API — call endpoints exposed by another addon
  • Models — define PROTO models for parameters and return values

About

Expose APIs from your Minecraft Bedrock Addons

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages