Описание
# Applied KJS (AE2 × KubeJS Bridge)
> A powerful AE2 ↔ KubeJS bridge for modpack developers that adds scriptable AE2 recipes, network monitoring, storage/crafting events, device inspection, and optional ME crafting job automation.
**Applied KJS** is a bridge mod for **Applied Energistics 2 (AE2)** and **KubeJS** that gives modpack developers deep, scriptable access to AE2 systems without writing a dedicated Java addon for every pack.
If you want to build AE2-focused progression, automation, diagnostics, alerts, or recipe overhauls in KubeJS, this mod is built for that workflow.
The **wiki page** can be found [**~~here~~**](https://kubejs.com/wiki/addons/applied-kjs)! (coming soon, you can view my pull request [here](https://github.com/wall5009/wiki/tree/appliedkjs-addon-page). And you can view the wiki page's raw code [here](https://github.com/wall5009/wiki/blob/appliedkjs-addon-page/wiki/addons/applied-kjs/page.kubedoc).)
***
## What this mod adds
### ✅ AE2 recipe scripting helpers for KubeJS
Create and manage AE2 recipe JSON from scripts, including helpers for common AE2 recipe types such as:
* Charger recipes
* Inscriber recipes (including press-style setups)
* Transform recipes
* Entropy recipes (heat/cool behavior)
* Matter Cannon ammo behavior entries
Also includes utilities to help with:
* Building recipe JSON safely
* Validating and stringifying recipe JSON
* Adding/removing AE2 recipes from KubeJS
* Removing recipes by output, type, or JSON match patterns (useful for large pack overhauls)
***
### ✅ AE2 key wrappers (items/fluids) exposed to JS
Work with AE2-style item/fluid keys in KubeJS-friendly objects.
This makes it easier to:
* Parse AE2 item/fluid identifiers
* Compare keys (exact/fuzzy matching)
* Read IDs/mod IDs/display names
* Format amounts similarly to AE2
* Serialize key data to JSON for logs, UIs, or debugging
Perfect for scripts that need to understand AE2 storage/crafting data in a clean way.
***
### ✅ ME network (grid) monitoring APIs
Inspect and track AE2 networks from scripts.
The bridge can expose grid summaries and network state so you can build custom logic around:
* Network online/offline state
* Power storage and usage
* Controller/channel state
* Node counts
* CPU counts
* Request/crafting counts
* Storage summary information
This is especially useful for:
* Progression systems
* Custom quests
* Server diagnostics
* Automation triggers
* Admin tools and alerts
***
### ✅ KubeJS events for AE2 activity (server-side)
React to AE2 events directly in your scripts.
Examples of event categories include:
#### Network lifecycle / status
* Network created / removed
* Network changed
* Network power state changes
#### Storage tracking
* Storage delta changes (item/fluid amount changes)
* Threshold crossing events (custom watch triggers)
#### Crafting lifecycle
* Crafting requested
* Crafting job started/completed/stopped
* Stuck crafting detection events
#### Player interaction / progression hooks
* Terminal opened events
* Player milestone events (for tutorials/quest progression)
This enables highly dynamic pack logic such as:
* Warning players when the ME system loses power
* Triggering quests when stock reaches a threshold
* Logging or notifying admins when a CPU gets stuck
* Unlocking guide chapters when players first interact with AE2 terminals
***
### ✅ Storage threshold watches
Register watches for specific AE2 items/fluids (optionally scoped to a specific grid) and react when stored amounts cross a threshold.
Great for:
* Low-stock alerts
* Automated progression checks
* Soft automation triggers
* Pack health monitoring / dashboards
***
### ✅ Optional scripted AE2 crafting request API (advanced)
Plan and optionally submit AE2 crafting jobs through scripts.
This can be used to:
* Simulate/plan an ME craft request
* Inspect required bytes and job details
* View missing/used/emitted items from a plan
* Submit a job (when valid requester context is provided)
* Track/cancel submitted jobs
This is a powerful feature for advanced packs that want **script-controlled AE2 automation logic**.
> **Important:** The crafting request API is **disabled by default** in the server config for safety/control. Pack devs must enable it manually.
***
### ✅ AE2 device inspection helpers
Inspect AE2-related block entities/devices at positions and read useful state for scripts or admin tools.
Depending on the device, this may include information like:
* Class/type name
* Position/dimension
* Active / powered state
* Drive/chest storage summary info
* Attached grid summary
Useful for:
* Debug commands
* Admin scripts
* Quest validation
* In-game diagnostic tools
***
### ✅ Progression milestone hooks (AE2-aware)
The bridge includes milestone-style hooks for player progression and tutorial flows.
This makes it easy to build pack onboarding logic like:
* First login milestone
* First AE2 craft milestone
* Controller crafted milestone
* Crafting terminal / molecular assembler milestones
* Other AE2 progression checkpoints
Ideal for:
* FTB Quests / custom questbooks
* In-game tutorial systems
* Unlock-based progression packs
***
### ✅ Debug commands and data dumps
Includes optional admin/debug command support (server-side, permission-gated) for collecting stats, grid summaries, and diagnostic dumps.
Excellent for:
* Pack development
* Multiplayer troubleshooting
* Profiling AE2 behavior in scripted setups
***
## Why modpack developers might want this
**Applied KJS** helps you build systems that would normally require writing a custom Java integration mod, such as:
* AE2-aware progression scripting
* Dynamic recipe rebalancing
* Stock monitoring and alerts
* Scripted automation control
* Custom diagnostics dashboards
* Admin support tooling
* Event-driven gameplay tied to ME activity
If you already use **KubeJS** heavily, this gives you a much deeper way to integrate **AE2** into your pack logic.
***
## Example use cases
* **Quest gating:** Detect when a player first opens a terminal and unlock a tutorial chapter.
* **Automation safety:** Alert admins when an ME network loses power or a crafting CPU gets stuck.
* **Resource management:** Fire events when Certus Quartz stock drops below a threshold.
* **Recipe overhaul packs:** Replace/adjust AE2 machine recipes entirely from KubeJS.
* **Progression packs:** Grant milestones when key AE2 components are crafted.
***
## Configuration (server-side)
The bridge is designed to be configurable for pack/server needs.
Typical options include toggles and limits for areas such as:
* Network events
* Storage events
* Crafting events
* Terminal events
* Progression hooks
* Debug commands
* Craft request API
* Scan intervals / tracking limits
* Event spam protection / throttles
* Logging verbosity
* Dimension filters / allowlists
> Recommended: Start with default settings, then enable advanced features (especially crafting request APIs) only when your scripts need them.
***
## Requirements / Compatibility
* **Minecraft:** 1.20.1 (Forge build shown here)
* **Requires:** Applied Energistics 2 (AE2)
* **Requires:** KubeJS
* **Loader:** Forge (this project page/build target)
> Always check the **Files** tab and changelog for the correct mod versions and dependency versions for your pack.
***
## Notes for script authors
This mod is primarily aimed at **server-side pack logic** and **modpack developer scripting workflows**.
In general:
* Use **startup scripts** to register reusable helpers/constants (if desired)
* Use **server scripts** for AE2 events, monitoring, thresholds, and automation logic
* Use **client scripts** only if a specific client-facing integration is provided by the build/version you are using
***
## Permissions & Modpack Use
You may include this mod in modpacks **subject to the project’s license/permission terms**.
Please refer to the project’s repository/license page for exact usage rights.
***
## Issue Reporting / Feedback
When reporting issues, please include:
* Minecraft version
* Loader/version (Forge)
* AE2 version
* KubeJS version
* Applied KJS version
* Logs and reproduction steps
* Relevant KubeJS scripts (if applicable)
This makes debugging integration issues much faster.
***
## TL;DR
**Applied KJS** turns AE2 into a scriptable system for KubeJS-powered modpacks — letting you build recipes, react to ME events, monitor grids, inspect devices, and (optionally) automate AE2 crafting flows with far less custom Java work.