mineflayer

n8n community node for Mineflayer - Minecraft bot automation

Package Information

Downloads: 20 weekly / 32 monthly
Latest Version: 0.1.0

Documentation

n8n-nodes-mineflayer

This is an n8n community node that provides Minecraft bot automation using Mineflayer.

Create and control Minecraft bots directly from your n8n workflows. Automate mining, building, combat, pathfinding, and more.

Supports Minecraft versions 1.8 to 1.21.8.

Nodes

This package contains two nodes:

Node Description
Mineflayer Execute actions with your Minecraft bot
Mineflayer Trigger React to Minecraft events in real-time

Installation

Follow the installation guide in the n8n community nodes documentation.

npm install n8n-nodes-mineflayer

Or install via the n8n UI: Settings → Community Nodes → Install → n8n-nodes-mineflayer

Credentials

Configure your Minecraft server connection:

Field Description Required
Host Server address (e.g., localhost or mc.example.com) Yes
Port Server port (default: 25565) No
Username Bot username Yes
Auth Type offline for cracked servers, microsoft for premium Yes
Version Minecraft version (auto-detect if empty) No

Mineflayer Node - Operations

Bot Resource

Operation Description
Create Connect bot to Minecraft server
Disconnect Disconnect bot from server
Get Status Get bot health, position, food, etc.
Respawn Respawn after death

Movement Resource (Pathfinder)

Operation Description
Go To Navigate to X, Y, Z coordinates
Follow Follow a player by name
Stop Stop all movement
Jump Make the bot jump
Look At Look at coordinates
Set Control Set movement state (forward, back, sprint, sneak, etc.)

Chat Resource

Operation Description
Send Message Send a chat message
Send Command Execute a command (e.g., /gamemode)
Whisper Whisper to a specific player

Combat Resource (PVP Plugin)

Operation Description
Attack Attack entity by ID
Attack Nearest Attack nearest entity of type
Stop Attack Stop attacking
Use Shield Raise or lower shield

World Resource

Operation Description
Get Block Get block info at position
Find Blocks Find blocks by type within range
Dig Dig/break a block
Place Block Place held block
Collect Block Mine and collect blocks (CollectBlock plugin)

Inventory Resource

Operation Description
Get Inventory List all inventory items
Equip Equip item to slot
Toss Drop/throw items
Equip Best Tool Auto-select best tool for block (Tool plugin)
Equip Armor Auto-equip best armor (Armor Manager)

Food Resource (Auto-Eat Plugin)

Operation Description
Eat Eat a specific food item
Enable Auto Eat Enable automatic eating
Disable Auto Eat Disable automatic eating

Crafting Resource

Operation Description
Craft Craft an item by name
Get Craftable Items List all craftable items

Container Resource

Operation Description
Open Chest Open chest at position
Deposit Item Put item into container
Withdraw Item Take item from container
Close Container Close current container

Entity Resource

Operation Description
Get Entities List nearby entities
Get Players List online players
Get Nearest Entity Find closest entity of type

Shooting Resource (Hawkeye Plugin)

Operation Description
Aim At Aim bow at coordinates
Shoot Draw and release bow

Mineflayer Trigger - Events

Core Events

Event Description
Chat Message When any chat message is received
Whisper When a private message is received
Spawn When bot spawns in world
Death When bot dies
Health Changed When health/food changes
Kicked When bot is kicked from server
Error When an error occurs

Player Events

Event Description
Player Joined When a player joins the server
Player Left When a player leaves
Player Death When any player dies

Entity Events

Event Description
Entity Spawn When entity spawns nearby
Entity Gone When entity despawns/dies
Entity Hurt When entity takes damage
Entity Attack When entity swings arm

World Events

Event Description
Block Update When a block changes
Rain When weather changes
Time When time updates
Explosion When explosion occurs

Combat Events

Event Description
Attacked When bot takes damage
Target Reached When combat target is defeated

Movement Events

Event Description
Goal Reached When pathfinder reaches destination
Path Update When path is recalculated
Stuck When bot cannot find path

Auto-Eat Events

Event Description
Started Eating When auto-eat begins
Finished Eating When auto-eat completes

Inventory Events

Event Description
Collect When bot picks up item
Window Open When container opens
Window Close When container closes

Misc Events

Event Description
Sleep When bot goes to sleep
Wake When bot wakes up
Experience When XP changes
Title When title text appears
Scoreboard When scoreboard updates
Boss Bar When boss bar appears

Included Plugins

This node integrates with the following Mineflayer plugins:

Plugin Purpose
mineflayer-pathfinder A* pathfinding navigation
mineflayer-pvp Combat and PVP/PVE
mineflayer-auto-eat Automatic food consumption
mineflayer-armor-manager Auto armor equipping
mineflayer-tool Smart tool selection
mineflayer-collectblock Block collection
mineflayer-hawkeye Bow aiming and shooting
prismarine-viewer Web-based world viewer

Example Workflows

Mining Bot

1. Mineflayer: Create bot
2. Mineflayer: Go to (mining coordinates)
3. Mineflayer: Find Blocks (diamond_ore)
4. Loop: For each block
   - Mineflayer: Equip Best Tool
   - Mineflayer: Dig
5. Mineflayer: Go to (home base)

Auto-Guard Bot

1. Mineflayer Trigger: Entity Spawn (filter: hostile mobs)
2. Mineflayer: Attack Nearest (zombie/skeleton/creeper)
3. Mineflayer Trigger: Statemachine wait for target death
4. Loop back to step 1

Chat Bot

1. Mineflayer Trigger: Chat Message (filter: /^!help/)
2. Switch: Check command
3. Mineflayer: Send Message (response)

AFK Farmer

1. Mineflayer: Create bot  
2. Schedule Trigger: Every 5 minutes
3. Mineflayer: Get Status (prevent AFK kick)
4. Mineflayer: Enable Auto Eat

Development

# Install dependencies
pnpm install

# Build
pnpm build

# Link for local testing
pnpm link

Resources

License

MIT

Discussion