Mineflayer Minecraft Bots


Finish Miner Bot
Create Farmer Bot
Create Server with Bots
More Bots!

I have programmed a Mineflayer Minecraft Bot to chop wood and craft a pickaxe. Eventually I want the bot to be able to do more complicated tasks. I tried Mineflayer first in 2020. I have forgotten about it for quite some time. Now I released the code under https://github.com/furcino/mc-miner-bot. 

The next thing to do would be to make the bot mine and craft items until he is able to mine diamonds. However, it would be even more fun to make bots that perform specific roles. For example a farmer, a warrior, a fisherman and so on. One could create a server with these bots and let them interact with real humans. However, maybe there is a reason why they have not included something like this in the game. It might get boring and repetitive.

Programming this bot really helped me to understand asynchronous methods and promises in Javascript. I still have some doubts if I am using the state machine correctly. It does the job, but I feel like I am missing something. The pathfinding works out of the box. I have however included a counter, which checks if the bot is stuck. In this case I switch states, which seems to help since the path gets recalculated. Another hack I did was adding an array for unreachable blocks. With the array, the bot will not try to chop down blocks he can not reach and just move on. 

The bot currently only works with oak. I plan to find a way for him to use all kinds of wood. It would be nice if the bot did not leave behind unfinished trees, but I think I would have to program that separately for every tree type. 

This is my first attempt: 

Now he does not get stuck as much and can craft a pickaxe: