Guide menu ▾

Macros

Craft and villager trading

The macro Craft and Villager trade steps: picking a recipe, gathering ingredients, the trade list, the result variable and the trade result condition.

Last updated: November 26, 2026

The Craft step makes the bot craft automatically in its inventory and the Villager trade step makes it trade in an open villager menu. Both are in the Inventory group and only work on the 3.5 bot engine. Crafting and trading are not console commands; you use them as macro steps (and by hand from the console window panel).

  1. 1Open the macro on the Tools → Macros page and add a Craft step with + Add step.
  2. 2Type the item name (e.g. torch) into Item to craft or use the Quick picks buttons, and enter the Count.
  3. 3If needed set the Also craft missing intermediate ingredients and Use a nearby crafting table boxes, then Save the macro.

The Craft step

The Craft step finds the recipe itself, takes the ingredients from the inventory and uses a crafting table if needed. Fields:

  • Item to craft: items with a recipe are searched; an item without a recipe is not found. For items with several recipes the Variant arrows cycle through them.
  • Count: 1-2304. The amount made per recipe is shown too.
  • Also craft missing intermediate ingredients (on by default): also crafts missing intermediates such as planks and sticks.
  • Use a nearby crafting table (on by default) and Crafting table distance (blocks) (1-32, default 8): walks to a table for 3×3 recipes. If the recipe is 3×3 and the box is off, nothing is crafted; the recipe preview says "Crafting table required" or "Crafted in the inventory (2×2)".
  • The preview also shows the materials needed for the amount and a Crafting tree section.

The Craft sticks and torches and Crafting table and chest templates are built with this step. To craft by hand while a window is open in the console, use the Recipes section described on Inventory and windows.

The Craft step: item, amount, crafting table distance, craft missing intermediate materials, recipe preview and required materials
The Craft step: item, amount, crafting table distance, craft missing intermediate materials, recipe preview and required materials

The Villager trade step

The Villager trade step finds and makes the trade that gives the item you want in an open villager trade menu. The menu must already be open; the bot only works in an open menu. The order of the trade does not matter, the bot picks the matching offer by its content.

FieldMeaning
Output itemThe item the trade gives (e.g. enchanted_book)
Enchantment, Enchantment levelThe wanted enchantment (e.g. mending) and level (0: any)
Input item, Input countThe item the trade takes and its count
Output count, Output nameTell offers selling the same item apart
Count0: until the stock or the trade runs out; at most 2304
Result variableDefault takas
The Villager trade step: item received, output amount, enchantment, item given, count and result variable fields
The Villager trade step: item received, output amount, enchantment, item given, count and result variable fields

Adding a trade to a macro from the trade list

With a villager menu open in the console, the window panel shows a Trade list. Trade on a row makes the trade at once; Add to macro adds that trade to a macro as a step: pick an existing macro or New macro, enter a name for a new one and press Add. The macro is assigned to the bot; if it cannot be assigned a "macro limit may be full" warning appears. If the macro has a complex structure, add the step with the editor on the Macros page. A step added from the trade list tries that offer first; if the offer changed it finds the trade by item and count.

The trade result and the condition

The Result variable holds the number of trades made; use it in messages as {$takas}. To check why the step stopped, pick Villager trade result (3.5 only) in a Condition step, type the variable name of the trade step into Variable holding the result (same as the trade step) and pick a status as the Value:

StatusWhen
Trade doneThe requested count was made, or the stock ran out (count 0)
Trade menu closedThe menu is not open or closed
Trade not foundNo matching offer
Trade lockedOut of stock or uses used up
Missing materialsNot enough items for the trade
Inventory fullNo room for the output
The server gave no tradeThe server gave no result after the selection

Example: add a Condition after the trade step with the status Missing materials; put a Send notification step in the ✓ If the condition holds block. You then get a notification when the materials run out. General use of conditions: If / Else.

Frequently asked questions

How do I craft automatically in a macro?

In the **Add step** window pick the **Craft** step from the **Inventory** group and enter the item and count. The bot finds the recipe, gathers ingredients and uses a crafting table if needed.

How do I automate villager trading with a macro?

With the villager menu open the Villager trade step makes the trade. The **Add to macro** button in the trade list fills in the step for you, and the Villager trade result condition checks the outcome.

Why did the Craft step produce nothing?

For a 3×3 recipe **Use a nearby crafting table** must be on and a table must be within **Crafting table distance**. If ingredients are missing, turn on **Also craft missing intermediate ingredients** and make sure the raw materials are in the inventory.

The trade step ends with "Trade locked", what should I do?

The villager is out of stock or its uses are used up. Wait for it to restock or try another villager; a Condition step can send you a notification in this case.

Craft and villager trading — AFKBot