dig-block
Remove blocks at specific coordinates in Minecraft to clear terrain, create openings, or gather resources for building and exploration.
Instructions
Dig a block at the specified position
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | X coordinate | |
| y | Yes | Y coordinate | |
| z | Yes | Z coordinate |
Implementation Reference
- src/tools/block-tools.ts:86-102 (handler)Handler function for the 'dig-block' tool. It retrieves the bot, checks for a block at the given coordinates, navigates if necessary, digs the block, and returns a success message.async ({ x, y, z }) => { const bot = getBot(); const blockPos = new Vec3(x, y, z); const block = bot.blockAt(blockPos); if (!block || block.name === 'air') { return factory.createResponse(`No block found at position (${x}, ${y}, ${z})`); } if (!bot.canDigBlock(block) || !bot.canSeeBlock(block)) { const goal = new goals.GoalNear(x, y, z, 2); await bot.pathfinder.goto(goal); } await bot.dig(block); return factory.createResponse(`Dug ${block.name} at (${x}, ${y}, ${z})`); }
- src/tools/block-tools.ts:81-85 (schema)Zod input schema for 'dig-block' tool defining required numeric parameters x, y, z coordinates.{ x: z.number().describe("X coordinate"), y: z.number().describe("Y coordinate"), z: z.number().describe("Z coordinate"), },
- src/tools/block-tools.ts:78-103 (registration)Registration of the 'dig-block' tool using ToolFactory.registerTool, including name, description, schema, and inline handler function.factory.registerTool( "dig-block", "Dig a block at the specified position", { x: z.number().describe("X coordinate"), y: z.number().describe("Y coordinate"), z: z.number().describe("Z coordinate"), }, async ({ x, y, z }) => { const bot = getBot(); const blockPos = new Vec3(x, y, z); const block = bot.blockAt(blockPos); if (!block || block.name === 'air') { return factory.createResponse(`No block found at position (${x}, ${y}, ${z})`); } if (!bot.canDigBlock(block) || !bot.canSeeBlock(block)) { const goal = new goals.GoalNear(x, y, z, 2); await bot.pathfinder.goto(goal); } await bot.dig(block); return factory.createResponse(`Dug ${block.name} at (${x}, ${y}, ${z})`); } );