This repository contains a Python script for creating and controlling a Minecraft bot using the Mineflayer library. The bot can be programmed to perform various actions in the Minecraft world based on received chat commands.
Before you can run the bot, make sure you have the following prerequisites installed:
- Python 3.x
- Node.js (for the
mineflayer
library) - Minecraft Java Edition (to connect the bot to a server)
- config.ini file with the necessary configuration details.
- Clone or download this repository to your local machine.
git clone https://github.com/Pepperjack-svg/minecraft-bot.git
- Install the required Python packages.
apt-get update
apt-get install -y nodejs
pip install -r requirements.txt
- Install the Mineflayer library for Node.js.
npm install mineflayer
Before running the bot, you need to configure it by editing the config.ini
file. Here's what the configuration file should contain:
[server]
host = <Minecraft_Server_IP>
port = <Server_Port>
[bot]
name = <Bot_Username>
[command]
position = !position
start = !start
stop = !stop
- Replace
<Minecraft_Server_IP>
with the IP address of the Minecraft server you want the bot to connect to. - Replace
<Server_Port>
with the port number of the Minecraft server (usually 25565). - Replace
<Bot_Username>
with the desired username for your bot. - Customize the chat commands under the
[command]
section as needed.
To start the bot, run the following command in your terminal:
python main.py
The bot will connect to the specified Minecraft server and listen for chat commands. It can perform actions like displaying its current position or moving forward and jumping when instructed.
To stop the bot, press Ctrl + C
in the terminal where it's running.
If you'd like to contribute to this project, feel free to fork the repository and submit a pull request. We welcome contributions and improvements.
- This project is based on the Mineflayer library for Node.js: Mineflayer
Enjoy experimenting with your Minecraft bot! If you have any questions or encounter issues, please feel free to open an issue in this repository.