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.
``bash
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
$3
| 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 |
$3
| 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.) |
$3
| Operation | Description |
|-----------|-------------|
| Send Message | Send a chat message |
| Send Command | Execute a command (e.g., /gamemode) |
| Whisper | Whisper to a specific player |
$3
| Operation | Description |
|-----------|-------------|
| Attack | Attack entity by ID |
| Attack Nearest | Attack nearest entity of type |
| Stop Attack | Stop attacking |
| Use Shield | Raise or lower shield |
$3
| 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) |
$3
| 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) |
$3
| Operation | Description |
|-----------|-------------|
| Eat | Eat a specific food item |
| Enable Auto Eat | Enable automatic eating |
| Disable Auto Eat | Disable automatic eating |
$3
| Operation | Description |
|-----------|-------------|
| Craft | Craft an item by name |
| Get Craftable Items | List all craftable items |
$3
| 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 |
$3
| Operation | Description |
|-----------|-------------|
| Get Entities | List nearby entities |
| Get Players | List online players |
| Get Nearest Entity | Find closest entity of type |
$3
| Operation | Description |
|-----------|-------------|
| Aim At | Aim bow at coordinates |
| Shoot | Draw and release bow |
Mineflayer Trigger - Events
$3
| 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 |
$3
| Event | Description |
|-------|-------------|
| Player Joined | When a player joins the server |
| Player Left | When a player leaves |
| Player Death | When any player dies |
$3
| 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 |
$3
| Event | Description |
|-------|-------------|
| Block Update | When a block changes |
| Rain | When weather changes |
| Time | When time updates |
| Explosion | When explosion occurs |
$3
| Event | Description |
|-------|-------------|
| Attacked | When bot takes damage |
| Target Reached | When combat target is defeated |
$3
| Event | Description |
|-------|-------------|
| Goal Reached | When pathfinder reaches destination |
| Path Update | When path is recalculated |
| Stuck | When bot cannot find path |
$3
| Event | Description |
|-------|-------------|
| Started Eating | When auto-eat begins |
| Finished Eating | When auto-eat completes |
$3
| Event | Description |
|-------|-------------|
| Collect | When bot picks up item |
| Window Open | When container opens |
| Window Close | When container closes |
$3
| 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
$3
`
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)
`
$3
`
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
`
$3
`
1. Mineflayer Trigger: Chat Message (filter: /^!help/)
2. Switch: Check command
3. Mineflayer: Send Message (response)
`
$3
`
1. Mineflayer: Create bot
2. Schedule Trigger: Every 5 minutes
3. Mineflayer: Get Status (prevent AFK kick)
4. Mineflayer: Enable Auto Eat
`
Development
`
bash
Install dependencies
pnpm installBuild
pnpm buildLink for local testing
pnpm link
``
Resources
- Mineflayer API Documentation
- n8n Community Nodes
- Mineflayer Plugins
- PrismarineJS GitHub
License
MIT