Skip to content

JsMacrosCE 2.1.0 ​

Highlights ​

  • Fabric and NeoForge builds now support Minecraft 26.1.2, 26.2, and 26.3, alongside 1.21.5, 1.21.8, 1.21.10, and 1.21.11.
  • The documentation site has been reworked, now featuring a scripting guide and API reference generated for each Minecraft version. The devkit ZIP includes the offline site, TypeScript declarations, and Python stubs.
  • Scripts can use stable type names such as EntityHelpers.Horse, Inventories.Anvil, and Widgets.Button instead of hard-coding Java package names.
  • JsMacros.stopScript() stops the current run, removes its listeners, releases its event locks, and interrupts its bound threads.
  • Rendering gained the Color library, Draw2D.clear(), and visibility and element management for Draw3D. Packet handling gained explicit protocol support and modern Mojang packet names.

Added ​

Scripting and game APIs

  • Script type namespaces for entities, inventories, widgets, render elements, NBT helpers, hit results, and utility classes. They work with instanceof/isinstance and are included in the generated editor typings. See Script type namespaces.
  • The player helper's tryFindAngles(pos[, face]) finds a yaw/pitch pair for aiming at a block without turning the player. tryLookAt now uses the same search.
  • World.getTimelines() and World.getClockManager() expose the data-driven clocks added in 26.1 and later.
  • BlockHelper.hasTag(...) and BlockStateHelper.hasTag(...) check block tags, including tags whose namespace is omitted.
  • Hud.createScreen(title, menuBackground, blurredBackground) adds an independent blur control to script screens.
  • Player.takePanorama(folder, callback) captures a panorama without the width and height arguments, which are ignored on 1.21.8 and later.
  • WorldScannerBuilder gained xor filter combinations, including xorStringBlockFilter() and xorStringStateFilter().

Rendering

  • The Color library creates and inspects packed ARGB colors with Color.rgb(...), Color.argb(...), Color.fromPacked(...), Color.withAlpha(...), and the alpha, red, green, and blue readers.
  • Draw2D.clear() removes an overlay's elements without unregistering it.
  • Draw3D gained visible/setVisible()/isVisible(), getElements(), and removeElement().

Packets and networking

  • Packet filters and packet-name lookups accept both legacy names and modern Mojang class names. event.type still reports the legacy name where one exists; legacy names are planned for removal in 3.0.0.
  • PacketByteBufferHelper can now encode and decode packets with an explicit protocol phase, look up protocol-specific packet and network-state IDs, and test whether a packet can be serialized.

Documentation

  • The guide covers installation, execution contexts, callbacks, threading, events, the player and world, key binds, custom commands, HUD drawing, screens, world scanning, and raw Minecraft access.
  • API pages are built per Minecraft version and show @since, cancellation, read-only, and deprecated metadata. Each page also has a plain Markdown twin for agents.

Changed ​

  • Draw3D.addBox, addLine, addTraceLine, addSurface, and reAddElement now return the added element. removeDraw2D returns the overlay. Existing calls that ignore the result still work.
  • The two-argument Hud.createScreen now enables the world blur as well as the menu background. Use the three-argument overload with false to turn blur off.
  • Surface lighting now accounts for the world's sky darkening, so world-lit surfaces dim correctly at night.

Fixed ​

  • Rendering: 3D box fill alpha, surface draw order, short and zero-width line drawing, Draw2D.addItem returning null, child overlays that have no init callback, and custom-image loading, drawing, and saving.
  • Screens and inventory: script screens no longer soft-lock when opened without a parent, Sodium's screen dimensions are respected, and Loom pattern selection, Enchantment tables with fewer than three options, and item-repair checks are fixed.
  • World and entities: the hunger-change event now fires, status-effect permanence and several entity edge cases are fixed, and chunk iteration no longer skips entries.
  • Runtime and networking: HTTP timeouts are applied, WebSocket callbacks use their own function context, files are read completely, event listeners release their locks correctly, stopping a script is no longer reported as a crash, and extension startup failures are contained and logged.

Upgrading ​

  • Existing scripts and profiles continue to work, except direct Java.type lookups of xyz.wagyourtail class names. Replace xyz.wagyourtail with com.jsmacrosce in those lookups. Prefer the script type namespaces where they provide the type you need.
  • If you use Python scripts, replace any older GraalPython extension with the JAR published with 2.1.0 in config/jsMacros/Extensions/. The extension must match the installed mod release; JavaScript is built in and needs no extension.
  • Fresh configurations start with the default ProfileLoad trigger for index.js disabled. Enable it in the Events tab if you want that script to run when a profile loads.

Quick examples ​

js
// Use stable type names instead of Java package names
const entities = World.getEntities(32);
if (entities !== null) {
  for (const entity of entities) {
    if (entity instanceof EntityHelpers.Horse) {
      Chat.log(`horse variant ${entity.getVariant()}`);
    }
  }
}

// Build packed colors with the Color library
const draw = Hud.createDraw2D();
draw.addRect(10, 10, 110, 60, Color.argb(0x80, 0, 0, 0));
draw.addText("panel", 16, 20, Color.rgb(0xFF, 0xFF, 0xFF), true);
draw.register();

// Find a yaw/pitch pair for a block without turning first
const player = Player.getPlayer();
if (player !== null) {
  const angles = player.tryFindAngles(PositionCommon.createBlockPos(10, 64, 10));
  if (angles !== null) player.lookAt(angles[0], angles[1]);
}

// Stop this run and remove its listeners; close resources first
JsMacros.stopScript();