A Minecraft bedrock addon compiler
bedrockc
bedrockc is a Node.js ESM compiler and CLI for turning a custom .bca source language into a Minecraft Bedrock add-on project with separate behavior and resource packs.
THIS PROJECT IS IN BETA PHASE --expect bugs
try:https://polar-compiler-mcpe-h8e2ax1id-pastahimselfs-projects.vercel.app/
Features
- Handwritten lexer and recursive-descent parser
- Structured diagnostics with file, line, and column information
- Whole-project semantic analysis with strict cross-resource references
- Deterministic manifest and JSON generation
- Separate behavior pack and resource pack emitters
build,compile,validate, andwatchCLI commands- Built-in example project and
node:testcoverage for critical subsystems
Install and Run
npm install
npm run compile -- --config ./examples/hello-addon/bedrockc.config.json
Source Language
import "./content/items.bca";
addon hello {
namespace: "demo";
version: [1, 0, 0];
}
item ruby {
id: "demo:ruby";
icon: "ruby";
texture: "textures/items/ruby";
display_name: "item.demo.ruby.name";
components: {
"minecraft:max_stack_size": 64
};
}
function give_ruby {
path: "give_ruby";
body: ["give @s demo:ruby 1"];
}
locale en_US {
"item.demo.ruby.name": "Ruby";
}
Configuration
bedrockc loads bedrockc.config.json by default.
{
"entry": "./src/main.bca",
"srcDir": "./src",
"outDir": "./dist",
"project": {
"slug": "hello-addon",
"namespace": "demo",
"version": [1, 0, 0],
"target": "1.21.100"
},
"packs": {
"behavior": {
"name": "Hello BP",
"description": "Behavior pack"
},
"resource": {
"name": "Hello RP",
"description": "Resource pack"
}
},
"scripts": {
"enabled": false,
"modules": []
}
}
CLI
npx bedrockc build --config ./bedrockc.config.json
npx bedrockc validate --config ./bedrockc.config.json
npx bedrockc watch --config ./bedrockc.config.json --debounce 75
npm run compiler:build -- --config ./bedrockc.config.json
npm run compiler:validate -- --config ./bedrockc.config.json
npm run compiler:watch -- --config ./bedrockc.config.json --debounce 75
Web Workbench
A static frontend workbench is available at web/index.html. It now supports two workflows:
Editormode for.bcasource and config editing with compiler output previewsUploadmode for.mcaddon,.mcpack, and.ziparchive analysis with diagnostics, unpacked file previews, and generated output when the upload is a bedrockc source project
Packaged .mcaddon, .mcpack, and packaged .zip uploads are analyzed directly in the browser so public Vercel deployments do not fail on request-size limits. Source-project archives still use the compiler bridge when possible, and fall back to a browser preview if the public upload request is rejected.
Upload mode now also supports in-browser editing for supported text files, browser-side Bedrock script validation, and an upload watch toggle that automatically reruns archive analysis after file edits or reverts. Script checks run against bundled Bedrock API typings, edited files stay local to the current browser session, and the workbench can download a patched archive after reanalysis.
Vercel Deployment
Vercel support is included through vercel.json, the serverless compiler bridge at api/compile.js, and the deployment build script scripts/prepare-public.js. The build script copies web/ into a generated public/ directory so Vercel has an explicit static output directory, while the frontend calls /api/compile for real compiler runs.
Archive upload support is exposed through api/archive.js. The upload API accepts multipart/form-data with a single archive file and supports .mcaddon, .mcpack, and .zip.
Deployment platforms such as Vercel or Render often run npm run build automatically. In this repo, build is the deployment packaging step only. Use npm run compiler:build or npx bedrockc build when you want to compile an add-on project yourself.
Project Layout
src/core/compiler.js: high-level compiler orchestrationsrc/syntax/parser.js: parsing and AST constructionsrc/semantic/analyzer.js: binding and validationsrc/emit/emitter.js: Bedrock output generation
Status
The current v1 supports the full requested asset catalog, but advanced Bedrock schemas still flow through typed declarations plus object-literal payloads instead of fully bespoke language syntax.