mineflayer-highway
v1.0.3
Published
Automatically builds highways in Minecraft using mineflayer with support for instant rebreak and auto refill from ender chests
Downloads
19
Maintainers
Readme
mineflayer-highway
A comprehensive Mineflayer plugin for automated highway construction in Minecraft. This plugin enables bots to build and maintain highways with configurable dimensions, automatic resource management, and advanced mining techniques.
Features
Core Functionality
- Automated Highway Construction: Builds highways with configurable width and height
- Directional Support: Supports all 8 directions (4 cardinal and 4 diagonal)
- Intelligent Pathfinding: Automatically determines the optimal direction based on bot orientation
- Floor Management: Multiple floor placement modes including replace and place-missing
- Railing System: Optional railings with corner support blocks
- Above-Railing Mining: Configurable mining of blocks above railings
Advanced Features
- Instant Rebreak: Implements instant rebreak mechanics for faster mining
- Auto Refill System: Automatically restocks from ender chests when resources run low
- Shulker Box Support: Searches shulker boxes for needed materials
- Inventory Management: Maintains minimum empty slots for efficient operation
- Resource Prioritization: Intelligently manages pickaxes, building blocks, and ender chests
Installation
npm install mineflayer-highwayDependencies
mineflayer^4.0.0vec3^0.1.8minecraft-data^3.0.0
Usage
Basic Example
const mineflayer = require('mineflayer');
const highway = require('mineflayer-highway');
const bot = mineflayer.createBot({
host: 'localhost',
port: 25565,
username: 'HighwayBuilder'
});
bot.loadPlugin(highway);
bot.once('spawn', () => {
bot.highway.start();
});Advanced Configuration
bot.once('spawn', () => {
bot.highway.start({
width: 5,
height: 3,
allowedBlocks: ['obsidian', 'netherite_block'],
floorMode: 'replace',
railings: true,
cornerSupportBlock: true,
mineAboveRailings: true,
instantRebreak: true,
rebreakDelay: 0,
minEmptySlots: 3,
searchEnderChest: true,
saveEnderChests: 2,
placeRange: 4.5,
rotation: true
});
});Configuration Options
Dimensions
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| width | Number | 5 | Width of the highway in blocks |
| height | Number | 3 | Height of the highway in blocks |
Block Management
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| allowedBlocks | Array | ['obsidian'] | List of blocks to use for construction |
| floorMode | String | 'replace' | Floor placement mode: 'replace' or 'placeMissing' |
Structure Options
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| railings | Boolean | true | Build railings on both sides |
| cornerSupportBlock | Boolean | true | Place support blocks under railings |
| mineAboveRailings | Boolean | true | Mine blocks above the railing level |
Mining Options
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| instantRebreak | Boolean | false | Enable instant rebreak mechanics |
| rebreakDelay | Number | 0 | Delay in ticks between rebreak attempts |
| rotation | Boolean | true | Enable rotation towards blocks when mining/placing |
Inventory Management
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| minEmptySlots | Number | 3 | Minimum empty inventory slots to maintain |
| searchEnderChest | Boolean | true | Search ender chest for materials |
| saveEnderChests | Number | 2 | Minimum ender chests to keep in inventory |
Placement
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| placeRange | Number | 4.5 | Maximum distance for block placement |
API Reference
Methods
bot.highway.start(options)
Starts the highway building process with optional configuration.
Parameters:
options(Object, optional): Configuration options
Returns: Promise
bot.highway.stop()
Stops the highway building process and clears all control states.
Returns: void
bot.highway.stats()
Returns current statistics about the highway building process.
Returns: Object containing:
blocksBroken(Number): Total blocks minedblocksPlaced(Number): Total blocks placeddistance(Number): Distance traveled from start position
Properties
bot.highway.config
Access to the current configuration object. Can be modified during operation.
State Machine
The plugin operates using a state machine with the following states:
- Forward: Moving forward and checking for tasks
- MineFront: Mining blocks in front of the bot
- MineFloor: Mining floor blocks that need replacement
- MineRailings: Mining blocks in railing positions
- MineAboveRailings: Mining blocks above the railing level
- PlaceFloor: Placing floor blocks
- PlaceRailings: Placing railing blocks
- PlaceCornerBlock: Placing corner support blocks
- Restock: Restocking materials from ender chests
Restocking Process
When the bot runs low on materials, it automatically:
- Builds a protective shield (2 blocks tall) in front and at current position
- Places an ender chest from inventory
- Opens the ender chest and searches for:
- Shulker boxes containing building materials
- Raw building blocks (obsidian, etc.)
- Diamond or Netherite pickaxes
- Additional ender chests
- Takes required items while maintaining minimum empty slots
- Mines the ender chest
- Removes the protective shield
- Resumes highway construction
Requirements
Bot Requirements
- Diamond or Netherite pickaxe for efficient mining
- Building blocks (obsidian recommended)
- Ender chests for restocking (if auto-refill enabled)
- Shulker boxes with materials (optional)
Server Requirements
- Server must allow block breaking and placement
- Sufficient permissions for the bot account
Performance Considerations
- Instant Rebreak: Provides faster mining but may trigger anti-cheat on some servers
- Width/Height: Larger dimensions require more resources and time
- Search Ender Chest: Adds overhead when restocking but provides automation
Troubleshooting
Bot stops unexpectedly
- Ensure sufficient materials in inventory or ender chest
- Check that
saveEnderChestsvalue allows restocking - Verify bot has proper tools for mining
Blocks not placing correctly
- Adjust
placeRangesetting - Ensure
allowedBlockscontains available materials - Check that bot is not moving too quickly
Restock not working
- Verify ender chest contains required materials in shulker boxes
- Ensure
searchEnderChestis set to true - Check that
minEmptySlotsallows room for new items
Contributing
Contributions are welcome. Please ensure all code follows the existing style and includes appropriate documentation.
License
This project is licensed under the GPL-3.0 License. See the LICENSE file for details.
Credits
Inspired by the Highway Builder module from Meteor Client, adapted for use with Mineflayer.
Author
Smol-Hanako
Support
For issues, questions, or contributions, please visit the GitHub repository: https://github.com/Smol-Hanako/mineflayer-highway
