simplified-mojang-jsons
v0.0.9
Published
An API in TypeScript for creating and managing the JSON configuration of vanilla and custom Minecraft Bedrock entities using type system support, OOP, and a more organized and reusable structure.
Maintainers
Readme
🛠️ Simplified Mojang JSONs
[!WARNING] ⚠️ WORK IN PROGRESS! ⚠️ This repository is constantly evolving and undergoing active updates, so some features or simplified methods may be missing or not yet implemented. Please keep this in mind when using it!
[!WARNING] 🌐 COMMENTS IN SPANISH! 🌐 All code comments in this repository are written in Spanish and I do not plan to translate them. Identifiers, documentation and public API names are in English.
A lightweight tool to mass-modify and update vanilla JSON files with automated/manual TypeScript export. Say goodbye to tedious bulk updates when vanilla changes break your custom setup—and hello to a cleaner, smarter way to script JSON addons.
Install:
Just run this in your project root:
npm install simplified-mojang-jsons@latestor via pnpm:
pnpm add simplified-mojang-jsons@latestBuild Setup:
To start writing your JSON templates in TypeScript, you need to copy the base generator script into your project.
Add these scripts to your package.json:
"scripts": {
"setup:export": "node -e \"const fs = require('fs'); const path = require('path'); const src = require.resolve('simplified-mojang-jsons/exporttojson'); const dest = path.join('scripts', 'generatejsons.ts'); fs.mkdirSync(path.dirname(dest), { recursive: true }); fs.copyFileSync(src, dest); console.log('✅ Export script copied to scripts/generatejsons.ts!');\"",
"export:json": "tsx scripts/generatejsons.ts"
}Then, run the setup command once in your terminal:
npm run setup:exportor via pnpm:
pnpm setup:exportThis will automatically create a scripts/generatejsons.ts file in your project structure.
How to Use
- Place your TypeScript template files inside your designated input folder (by default, the script looks in a
test/folder or you can adjust it inside your copiedgeneratejsons.ts). - Run the export command to compile your TS code and instantly output clean, formatted vanilla JSON files:
npm run export:jsonor via pnpm:
pnpm export:jsonAvailable Modules & Components
The API is split up into several handy modules, components, and pre-made templates to fit whatever your development workflow needs. Here is what's currently available out of the box:
[!NOTE] ⚠️ Vanilla Templates Notice: Some pre-made vanilla templates might not be 100% valid or fully functional out of the box in the game due to Minecraft updates or internal structure shifts. Feel free to modify them once they are exported into their final format or tweak them directly in your code!
[!NOTE] The wrapped modules might not have every single edge case fully mapped out just yet. I'll be adding the rest and keeping things updated to make your dev experience as smooth as possible.
1. Custom Builders (create...)
Functions designed to programmatically build, structure, and customize your behavior pack JSONs using TypeScript type support and OOP:
import {
// BP Manifest
createBPManifest,
// BP Stuff's
createBPAnimController,
createBPBiome,
createBPBlock,
createBPDialogue,
createBPDimension,
createBPEntity,
createBPFeature,
createBPFeatureRule,
createBPItemCatalog,
createBPItem,
createBPLootTable,
createBPRecipe,
createBPSpawnRule,
createBPTrading,
} from "simplified-mojang-jsons";2. Root Components (...Components)
Modular configurations and property wrappers to fine-tune specific behavior features:
BPBiomeComponents: Manage biome-specific components like fog, lighting, and sound settings.BPBlockComponents: Handle block traits, collision boxes, creative categories, and component definitions.BPDimensionComponents: Configure custom dimension behaviors and environment rules.BPEntityComponents: Set up entity components such as movement, component groups, and event triggers.BPItemComponents: Define custom item behaviors, hand actions, and attributes.BPSpawnRuleComponents: Adjust spawning conditions, mob caps, and herd rules.
import {
BPBiomeComponents,
BPBlockComponents,
BPDimensionComponents,
BPEntityComponents,
BPItemComponents,
BPSpawnRuleComponents,
} from "simplified-mojang-jsons";3. Pre-made Templates (...Templates)
Ready-to-use base vanilla templates that you can quickly override, modify, and export:
BPBiomeTemplates: Base vanilla biome configurations.BPEntityTemplates: Base vanilla entity files ready for modification.BPFeatureTemplates&BPFeatureRuleTemplates: World generation and feature rule blueprints.BPLootTableTemplates: Standard loot tables for blocks, entities, and fishing.BPRecipeTemplates: Crafting and smelting recipe templates.BPSpawnRuleTemplates: Default mob spawn rules.BPTradingTemplates: Villager and wandering trader trade offers.
import {
BPBiomeTemplates,
BPEntityTemplates,
BPFeatureTemplates,
BPFeatureRuleTemplates,
BPLootTableTemplates,
BPRecipeTemplates,
BPSpawnRuleTemplates,
BPTradingTemplates,
} from "simplified-mojang-jsons";Contributing
Got an idea, found a bug, or want to add support for missing vanilla JSON schemas or components? Contributions are more than welcome!
- Getting Started: Please check out our Contributing Guide before opening a pull request.
- Community Guidelines: Be kind and respectful. See our Code of Conduct.
- Security: To report a security vulnerability, please follow the steps in our Security Policy.
- Releases: Check what's new in each update in the Changelog.
Author & License
Developed by HaJuegos.
This project is licensed under the MIT License — free to use, modify, and distribute in your own Minecraft Bedrock projects.
