How eaglerforge/eaglerforgeinjector works
Purpose and Inputs
EaglerForgeInjector transforms compatible EaglercraftX offline builds into runtime-modifiable builds. It pattern-matches unminified, unobfuscated, unsigned client/server JavaScript, injects hooks and a core ModAPI runtime, and can package/minify the result. Primary user entry points are the browser uploader in index.html, Node CLI in cli.js, and package wrapper in npx_wrapper.js.
Invocation Surfaces
Browser execution is coordinated by browser.js, with index.html providing the offline/hosted UI. CLI execution starts in cli.js; it is intended for larger builds and transformation/minification workflows that exceed browser memory limits. backgroundLogger.js supports progress/logging behavior across these execution contexts.
Transformation Pipeline
core/core.js is the central injector/orchestrator: it consumes an Eaglercraft build, locates known structural patterns, and applies rewrite stages. core/patches.js contains the architecture-critical patch definitions that introduce interception points into target code. core/minify.js is the output optimization boundary, used when producing compact transformed artifacts.
Runtime Bootstrap and ModAPI
The injected runtime is centered on core/postinit.js, which initializes the global ModAPI after the target application is available. This separates static source rewriting from runtime extension: the injector adds stable access points, while mods use ModAPI to hook or alter live Eaglercraft behavior.
Extension, Hooking, and Reflection
core/modloader.js loads mod scripts into the injected environment. core/core.js and core/postinit.js jointly expose the runtime-facing API needed for monkey patching, method hooks, reflection, and custom classes. Example consumers under examplemods/ demonstrate the expected mod boundary; they are separate payloads rather than part of the injector core.
Dedicated Server and UI Integration
core/efserver.js handles dedicated-server-specific modification paths, extending the same injection model beyond the browser client. core/modgui.js provides the in-game or injected mod-management UI layer, keeping user-facing mod controls distinct from source transformation and runtime loading.
Outputs and External Boundaries
The system operates entirely on user-supplied Eaglercraft download artifacts and local JavaScript modules; no backend service is required for core operation. Browser usage depends on file upload/browser runtime constraints, while CLI/NPX usage depends on Node.js and dependencies declared in package.json and locked in package-lock.json. Documentation of the exposed API and intended extension contracts lives in docs/apidoc/ and docs/architecture.md.
Main entry points: core.js Injector orchestrator · cli.js Node CLI · browser.js Browser coordinator · postinit.js ModAPI bootstrap
Components 18
Invocation surfaces
- Browser uploader UI · Offline or hosted upload interface.
index.html - Browser coordinator
browser.js - Node CLI · Handles larger transformation and minification workflows.
cli.js - NPX wrapper
npx_wrapper.js - Progress logger
backgroundLogger.js
Injection pipeline
- Injector orchestrator · Finds known structures and applies rewrite stages.
core/core.js - Patch definitions · Defines interception points inserted into target code.
core/patches.js - Server injection path
core/efserver.js - Output minifier
core/minify.js
Injected runtime
- ModAPI bootstrap · Initializes global ModAPI after the target application is available.
core/postinit.js - Mod script loader
core/modloader.js - Mod management UI
core/modgui.js
Extension boundary
- Example mod payloads · Separate consumers of the injected extension contract.
- API documentation
- Architecture guide
docs/architecture.md
Other components
- Eaglercraft build · Compatible unsigned, unobfuscated client or server JavaScript.
- Transformed artifact · Runtime-modifiable client or server build.
- Node dependencies · Required by CLI and NPX execution.
package.json
Connections 21
- Browser uploader UI → Browser coordinator: starts
- Browser coordinator → Injector orchestrator: invokes
- Node CLI → Injector orchestrator: invokes
- NPX wrapper → Node CLI: wraps
- Browser coordinator → Progress logger: reports through
- Node CLI → Progress logger: reports through
- Eaglercraft build → Injector orchestrator: input
- Injector orchestrator → Patch definitions: uses
- Injector orchestrator → Server injection path: routes server builds
- Injector orchestrator → ModAPI bootstrap: injects
- Injector orchestrator → Mod script loader: injects
- Injector orchestrator → Mod management UI: injects
- Injector orchestrator → Output minifier: optionally optimizes
- Output minifier → Transformed artifact: emits
- Injector orchestrator → Transformed artifact: emits unminified
- ModAPI bootstrap → Mod script loader: initializes runtime for
- Mod script loader → Example mod payloads: loads
- Example mod payloads → ModAPI bootstrap: uses ModAPI hooks
- API documentation → Example mod payloads: documents contract
- Node dependencies → Node CLI: supports
- Node dependencies → NPX wrapper: supports