Skip to content

JsMacrosCE 2.3.0 ​

Highlights ​

  • Scripts can read item component defaults and per-stack changes separately. Typed getters expose durability, bundle contents, potion effects, and more without looking up component IDs.
  • Smithing scripts can read each input by name, and getOutput() returns the result shown in the smithing table.
  • Inventory helpers now report actual slot positions and expose all four cells of the player's crafting grid.
  • Blast Furnaces and Smokers use the existing furnace helper. Crafter and mount slot maps reflect their actual menus.
  • Magma Cubes match EntityHelpers.Slime again on Minecraft 26.2 and 26.3.

Added ​

Item stacks

  • stack.getComponents() reads the stack's effective components, including defaults inherited from the item. getMaxDamage() and getDamage() return numbers when present and null when absent. getCustomData() reads arbitrary NBT attached to the stack.
  • getBundleContents() reads the bundle's items, fullness, and selection. getContainerContents() preserves slot positions in stored inventories such as shulker boxes. getPotionContents() reads the base potion, effects, and color on potions and tipped arrows.
  • getFood(), getConsumable(), and getUseRemainder() read a stack's nutrition, consumption settings and effects, and item leftover after use.
  • getWrittenBookContents() reads a signed book's metadata and formatted pages. getWritableBookContents() reads a book and quill's plain-text pages. getStoredEnchantments() reads enchantments stored in an enchanted book.
  • getFireworks() and getFireworkExplosion() read rocket flight duration and the shapes, colors, trails, and twinkle of explosions.
  • getTool(), getAttributeModifiers(), and getUseCooldown() expose mining rules, attribute modifiers, and the configured cooldown.
  • getEquippable() reads the equipment slot, worn appearance, and equip rules. getArmorTrim(), getDyedColor(), and getCustomModelData() expose the stack's appearance settings.
  • getLodestoneTracker() reads a compass's saved target position, dimension, and tracking flag. getMapId() reads a filled map's numeric ID.
  • On Minecraft 26.3 and later, getCookingFuel() and getBrewingFuel() read furnace and brewing fuel settings, including values supplied by data-pack number providers.
  • Use getIds(), has(id), and get(id) for component lookup by ID. Use getChanges() to read saved additions, overrides, and removals separately.

Inventories

  • Inventories.Smithing has getTemplate(), getBase(), and getAddition() for the three smithing inputs.
  • Inventory.getScreenPos() returns the top-left corner of the inventory panel in GUI-scaled coordinates.

Changed ​

  • SmithingInventory.getOutput() now returns the result in slot 3. It previously returned the addition input in slot 2.
  • Inventory.getSlotPos(slot) now returns the selected slot's top-left corner in GUI-scaled coordinates. It previously returned the panel origin regardless of the slot.
  • PlayerInventory.getInput() now returns the 2×2 crafting grid as [column][row]. Its width and height are both 2, and its crafting slot count is 4. getInput(x, y) throws IndexOutOfBoundsException for coordinates outside the grid.
  • Mobs without a more specific helper now match EntityHelpers.Mob, so scripts can read their aggressive and no-AI flags.
  • ItemStackHelper.getNBT() is deprecated and omitted from the generated reference and typings. Existing scripts can still call it at runtime for the same encoded component changes.

Fixed ​

  • Player.openInventory() and the OpenContainer event now return an Inventories.Furnace wrapper for Blast Furnaces and Smokers, giving scripts access to the same fuel, progress, and recipe-book methods as a regular furnace.
  • The Crafter slot map now keeps main and hotbar aligned with the player inventory. Use getSlots("input") for the 3×3 grid and getSlots("preview") for the recipe preview, which cannot be taken.
  • Horse inventory checks and slot maps now follow the menu's enabled saddle and armor slots. On Minecraft 1.21.11 and later, the generic Nautilus inventory also maps those slots when enabled.
  • On Minecraft 26.2 and 26.3, Magma Cubes once again expose getSize() and isSmall() through EntityHelpers.Slime.

Upgrading ​

Update scripts that relied on the previous return values:

If the script used…Use…
Smithing getOutput() to read the addition inputgetAddition()
getSlotPos(slot) to read the inventory panel origingetScreenPos()

Smithing's getLeftInput() and getRightInput() still work but are deprecated and planned for removal in 3.0.0. Replace them with getTemplate() and getBase(), respectively. Scripts that worked around the Crafter's shifted player-slot indices can now use getSlots("main") and getSlots("hotbar") directly.

Replace stack.getNBT() with stack.getComponents().getChanges() to read the saved changes. The new method returns an empty compound when there are no changes, and null if a change cannot be encoded. If a script used null to mean “unchanged,” check whether getKeys() is empty on the returned compound.