JsMacros API Reference
Version: dev
Minecraft: 26.2
This reference is generated from the sources for this Minecraft target. Signatures, raw Minecraft types, and behavior can differ between versions; the version selector in the navigation bar opens another target. New to JsMacros? Start with the Guide.
Start here
- Libraries (17) — The global objects a script starts with:
Chat,World,Player,Hud,JsMacros, and more. - Events (57) — Typed signals from the game. Subscribe with
JsMacros.on, wait withwaitForEvent, and read each event page for its payload and cancellation rules. - Classes (353) — Objects returned by libraries and events: entities, blocks, inventories, draw elements, screens, and builders.
- Type namespaces (7) — Stable script names for Java types, such as
EntityHelpers.Horse. They are forinstanceofand static access, not a second class list.
Common entry points
- Chat — Provides client chat, server messaging, overlay display, and text-formatting functions to scripts as the Chat variable.
- World — Functions for getting and using world data.
- Player — Functions for getting and modifying the player's state.
- Hud — Screen, overlay, texture, and window-state APIs exposed to scripts as Hud.
- JsMacros — Script library for event listeners, script execution, and profile services.
- KeyBind — Gets and changes key and keybind states through the script global KeyBind.
How to read a page
- The large title is the script name. The small monospace line is the fully qualified Java name used by
Java.typeand reflection. read-onlymarks a field you should not write. It is not a constant and can still change over time.Sinceis the JsMacros version that introduced the member, not the Minecraft version.- Overloads share a heading but keep separate signatures and descriptions. Read the parameters to choose one.
- A compatibility stub can exist on a target without the full behavior. Read the description, not just the signature.
Script type namespaces
JavaScript and Python scripts get these globals automatically. They are read-only aliases of real Java types, so instanceof and isinstance work without a package name.
- EntityHelpers (80) — Lets scripts identify entity helpers through the EntityHelpers global, without knowing their Java package names.
- HitResults (3) — Lets scripts distinguish block and entity targeting results through the HitResults global.
- Inventories (18) — Lets scripts identify inventory wrappers through the Inventories global, instead of matching screen-name strings.
- NBTHelpers (4) — Lets scripts distinguish numbers, lists, and compounds in NBT data through the NBTHelpers global.
- RenderElements (14) — Lets scripts identify 2D and 3D drawing elements through the RenderElements global.
- ScriptClasses (2) — Gives scripts access to image creation and key-tracking utilities through the ScriptClasses global.
- Widgets (7) — Lets scripts identify buttons, sliders, and other widget helpers through the Widgets global.