# JsMacros API Reference

Version: `2.1.0`  
Minecraft: `1.21.8`

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](/guide/).

## Start here

- **[Libraries](./libraries.md) (17)** — The global objects a script starts with: `Chat`, `World`, `Player`, `Hud`, `JsMacros`, and more.
- **[Events](./events.md) (57)** — Typed signals from the game. Subscribe with `JsMacros.on`, wait with `waitForEvent`, and read each event page for its payload and cancellation rules.
- **[Classes](./classes.md) (353)** — Objects returned by libraries and events: entities, blocks, inventories, draw elements, screens, and builders.
- **[Type namespaces](./types/index.md) (7)** — Stable script names for Java types, such as `EntityHelpers.Horse`. They are for `instanceof` and static access, not a second class list.

## Common entry points

- [Chat](./libraries/com/jsmacrosce/jsmacros/client/api/library/impl/FChat.md) — Provides client chat, server messaging, overlay display, and text-formatting functions to scripts as the Chat variable.
- [World](./libraries/com/jsmacrosce/jsmacros/client/api/library/impl/FWorld.md) — Functions for getting and using world data.
- [Player](./libraries/com/jsmacrosce/jsmacros/client/api/library/impl/FPlayer.md) — Functions for getting and modifying the player's state.
- [Hud](./libraries/com/jsmacrosce/jsmacros/client/api/library/impl/FHud.md) — Screen, overlay, texture, and window-state APIs exposed to scripts as Hud.
- [JsMacros](./libraries/com/jsmacrosce/jsmacros/core/library/impl/FJsMacros.md) — Script library for event listeners, script execution, and profile services.
- [KeyBind](./libraries/com/jsmacrosce/jsmacros/client/api/library/impl/FKeyBind.md) — 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.type` and reflection.
- `read-only` marks a field you should not write. It is not a constant and can still change over time.
- `Since` is 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](./types/EntityHelpers.md) (80) — Lets scripts identify entity helpers through the EntityHelpers global, without knowing their Java package names.
- [HitResults](./types/HitResults.md) (3) — Lets scripts distinguish block and entity targeting results through the HitResults global.
- [Inventories](./types/Inventories.md) (18) — Lets scripts identify inventory wrappers through the Inventories global, instead of matching screen-name strings.
- [NBTHelpers](./types/NBTHelpers.md) (4) — Lets scripts distinguish numbers, lists, and compounds in NBT data through the NBTHelpers global.
- [RenderElements](./types/RenderElements.md) (14) — Lets scripts identify 2D and 3D drawing elements through the RenderElements global.
- [ScriptClasses](./types/ScriptClasses.md) (2) — Gives scripts access to image creation and key-tracking utilities through the ScriptClasses global.
- [Widgets](./types/Widgets.md) (7) — Lets scripts identify buttons, sliders, and other widget helpers through the Widgets global.
