Go to file
2021-04-19 07:51:48 +00:00
jobs Remove redundant module reloads 2021-04-19 07:51:48 +00:00
protocol Detect disconnection and exit the script 2021-03-26 22:25:55 +00:00
.gitignore Rename data module to mcdata 2020-12-14 05:40:17 +00:00
blocks.py Remove redundant module reloads 2021-04-19 07:51:48 +00:00
bot.py Remove redundant module reloads 2021-04-19 07:51:48 +00:00
download_mcdata.sh Rename data module to mcdata 2020-12-14 05:40:17 +00:00
game.py Remove redundant module reloads 2021-04-19 07:51:48 +00:00
items.py Simplify handling block and item ids 2021-04-18 23:02:16 +00:00
job.py Remove redundant module reloads 2021-04-19 07:51:48 +00:00
LICENSE Initial commit 2020-05-20 15:41:01 -06:00
main.py Add state machine for eating food 2021-01-05 05:57:06 +00:00
mcdata.py Finish executing the villager trade 2021-02-24 01:02:00 +00:00
mobs.py Rename data module to mcdata 2020-12-14 05:40:17 +00:00
monkey_patch.py Detect disconnection and exit the script 2021-03-26 22:25:55 +00:00
path.py Remove redundant module reloads 2021-04-19 07:51:48 +00:00
print_help.py Add !help command 2021-04-19 04:18:40 +00:00
README.md Add !help command 2021-04-19 04:18:40 +00:00
requirements.txt Update requirements 2021-04-19 01:51:20 +00:00
test_pycraft.py Rename test script 2020-09-06 15:37:04 -06:00
utils.py Remove redundant module reloads 2021-04-19 07:51:48 +00:00
vector.py Move to our own vector module instead of Panda3D 2021-03-26 22:25:55 +00:00

Minecraft Bot

Setup

Assuming Debian / Ubuntu based distro:

$ sudo apt update
$ sudo apt install build-essential python3 python3-dev python3-pip python3-virtualenv git

$ git clone https://git.tannercollin.com/tanner/minecraft-bot.git
$ cd minecraft-bot/
$ bash download_mcdata.sh
$ virtualenv -p python3 env
$ source env/bin/activate
(env) $ pip install -r requirements.txt

Always make sure the virtual environment is running (env).

Running

(env) $ USERNAME=you@domain.com PASSWORD=supersecret SERVER=example.com python main.py

Commands

Talking to bot (All commands can be found in "game.py" under "public commands", starting around line 494)

Use prefix (in this case, "1") to call to attention before giving command. (EX. 1ping, 1here, etc.)

Public Commands

These can be ran by anyone, all bots will reply.

!help - prints this whole help message to console

!help [command] - replies in-game explaining command

!ping - replies with "pong"

!echo [data] - replies with "data"

!pos - replies with position and dimension

!afk - goes AFK with /afk

!unafk - goes not AFK with /afk

!error - raises an error

!inv - prints current inventory

!time - replies with Minecraft world time

!count [id] - counts the number of items with that id

!loaded - replies with the current loaded area

!players - prints the current players

!players clear - clears the current player list

!objects - prints the current items on ground

!objects clear - clears the current object list

!mobs - prints the current mobs

!mobs clear - clears the current mob list

!monsters - prints the current monsters

!villagers - prints the current villagers

!threats - prints the dangerous monsters within 20 blocks

!threats [num] - prints the dangerous monsters within num blocks

"zzz" or !zzz - bot does /afk to let others sleep

!tree - replies with the closest tree

!block x y z - replies what block is at (x, y, z)

Bot-specific Commands

These will only run for the bot they are addressed to.

1respawn - respawns the bot if it's dead

1gather wood - gathers wood from the world

1gather sand - gathers sand from the world

1farm wood - farms wood from a certain area

1farm sand - farms sand from a certain area

1farm wart - farms netherwart from a certain area

1farm crop - farms mature crops from a certain area

1loiter - stands still but eats, sleeps, and flees

1trade - sells items to villagers to get emeralds

1stop - stops the current job and resets bot

1drop - drops the current stack its holding

1select [id] - moves item with id into main hand

1dump [id] - drops all items matching id

1drain - drops all items in inventory

1fill [x] [y] [z] [x] [y] [z] - fills the cuboid with the block at the first coordinate

1here - bot comes to your location

1goto [x] [y] [z] - sends the bot to coordinate (x, y, z)

1close - closes the current Minecraft window

1click [slot] [button] [mode] - clicks the current window

1use - use the item it's currently holding

1interact [entity id] - interacts with that entity

Authorized Commands

These dangerous commands can only be ran by the bot owner.

1print [expression] - replies with Python eval(expression)

1exit - exits the program