Skip to content

Pepperjack-svg/minecraft-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minecraft Bot with Python and Mineflayer

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.

Prerequisites

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.

Installation

  1. Clone or download this repository to your local machine.
git clone https://github.com/Pepperjack-svg/minecraft-bot.git
  1. Install the required Python packages.
apt-get update
apt-get install -y nodejs
pip install -r requirements.txt
  1. Install the Mineflayer library for Node.js.
npm install mineflayer

Configuration

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.

Usage

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.

Contributing

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.

Acknowledgments

  • 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.

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages