mosfet/README.md

172 lines
4.2 KiB
Markdown
Raw Permalink Normal View History

2021-04-21 21:47:25 +00:00
# Mosfet Minecraft Bot
A general-purpose Minecraft 1.16 bot written in Python.
Mosfet is able to farm wood by cutting trees, gather sand, gather netherwart,
and trade with villagers to get emeralds. He can eat, sleep, and flee from
threats.
2020-09-10 21:33:52 +00:00
## Requirements
- Python >= 3.8
- pip
- virtualenv
- git
- wget
- unzip
2021-04-22 01:46:19 +00:00
## Linux Setup
2020-09-10 21:33:52 +00:00
Assuming Debian / Ubuntu based distro:
```
$ sudo apt update
$ sudo apt install build-essential python3 python3-dev python3-pip python3-virtualenv virtualenv git wget unzip
2020-12-15 22:37:32 +00:00
2021-01-05 06:15:12 +00:00
$ git clone https://git.tannercollin.com/tanner/minecraft-bot.git
$ cd minecraft-bot/
2020-09-10 21:33:52 +00:00
```
## Running
```
2021-04-26 03:26:07 +00:00
$ USERNAME=you@domain.com PASSWORD=supersecret SERVER=example.com ./run_linux.sh
2020-09-10 21:33:52 +00:00
```
2021-03-26 22:18:46 +00:00
## Commands
2021-04-21 21:47:25 +00:00
The command prefix character is the last character of the bot's name. For
example, if the bot's name is `mosfet1`, then you would issue commands like
`1farm wood` or `1pos`. This lets you run multiple bots on the same server.
The exception are the below public commands, they can optionally be prefixed with `!`
and all bots will run the command.
2021-03-26 22:18:46 +00:00
2021-04-21 21:47:25 +00:00
Commands can be issued in public chat or private message like `/msg mosfet1
1farm wood`. The bot will reply the same way the command was issued.
2021-03-26 22:18:46 +00:00
2021-04-21 21:47:25 +00:00
Use `echo` to make Mosfet run Minecraft commands. For example, `1echo /sethome
home` will cause him to issue the `/sethome` command.
2021-03-26 22:18:46 +00:00
2021-04-19 03:59:00 +00:00
### Public Commands
2021-03-26 22:18:46 +00:00
2021-04-19 04:18:40 +00:00
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
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`!ping` - replies with "pong"
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`!echo [data]` - replies with "data"
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`!pos` - replies with position and dimension
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`!afk` - goes AFK with /afk
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`!unafk` - goes not AFK with /afk
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`!error` - raises an error
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`!inv` - prints current inventory
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`!time` - replies with Minecraft world time
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`!count [id]` - counts the number of items with that id
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`!loaded` - replies with the current loaded area
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`!players` - prints the current players
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`!players clear` - clears the current player list
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`!objects` - prints the current items on ground
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`!objects clear` - clears the current object list
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`!mobs` - prints the current mobs
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`!mobs clear` - clears the current mob list
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`!monsters` - prints the current monsters
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`!villagers` - prints the current villagers
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`!threats` - prints the dangerous monsters within 20 blocks
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`!threats [num]` - prints the dangerous monsters within num blocks
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`"zzz" or !zzz` - bot does /afk to let others sleep
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`!tree` - replies with the closest tree
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`!block x y z` - replies what block is at (x, y, z)
2021-03-26 22:18:46 +00:00
2021-04-19 03:59:00 +00:00
### Bot-specific Commands
2021-03-26 22:18:46 +00:00
2021-04-19 04:18:40 +00:00
These will only run for the bot they are addressed to.
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`1respawn` - respawns the bot if it's dead
2021-03-26 22:18:46 +00:00
2021-04-19 04:02:51 +00:00
`1gather wood` - gathers wood from the world
2021-04-19 03:59:00 +00:00
2021-04-19 04:02:51 +00:00
`1gather sand` - gathers sand from the world
2021-04-19 03:59:00 +00:00
2021-04-19 04:02:51 +00:00
`1farm wood` - farms wood from a certain area
2021-04-19 03:59:00 +00:00
2021-04-19 04:02:51 +00:00
`1farm sand` - farms sand from a certain area
2021-04-19 03:59:00 +00:00
2021-04-19 04:02:51 +00:00
`1farm wart` - farms netherwart from a certain area
2021-04-19 03:59:00 +00:00
2021-04-19 04:02:51 +00:00
`1farm crop` - farms mature crops from a certain area
2021-04-19 03:59:00 +00:00
2021-04-19 04:02:51 +00:00
`1loiter` - stands still but eats, sleeps, and flees
2021-04-19 03:59:00 +00:00
2021-04-19 04:02:51 +00:00
`1trade` - sells items to villagers to get emeralds
2021-04-19 03:59:00 +00:00
2021-04-19 04:02:51 +00:00
`1stop` - stops the current job and resets bot
2021-04-19 03:59:00 +00:00
2021-04-19 04:02:51 +00:00
`1drop` - drops the current stack its holding
2021-04-19 03:59:00 +00:00
2021-04-19 04:02:51 +00:00
`1select [id]` - moves item with id into main hand
2021-04-19 03:59:00 +00:00
2021-04-19 04:02:51 +00:00
`1dump [id]` - drops all items matching id
2021-04-19 03:59:00 +00:00
2021-04-19 04:02:51 +00:00
`1drain` - drops all items in inventory
2021-04-19 03:59:00 +00:00
2021-04-19 04:02:51 +00:00
`1fill [x] [y] [z] [x] [y] [z]` - fills the cuboid with the block at the first coordinate
2021-04-19 03:59:00 +00:00
2021-04-19 04:02:51 +00:00
`1here` - bot comes to your location
2021-04-19 03:59:00 +00:00
2021-04-19 04:02:51 +00:00
`1goto [x] [y] [z]` - sends the bot to coordinate (x, y, z)
2021-04-19 03:59:00 +00:00
2021-04-19 04:02:51 +00:00
`1close` - closes the current Minecraft window
2021-04-19 03:59:00 +00:00
2021-04-19 04:02:51 +00:00
`1click [slot] [button] [mode]` - clicks the current window
2021-04-19 03:59:00 +00:00
2021-04-19 04:02:51 +00:00
`1use` - use the item it's currently holding
2021-04-19 03:59:00 +00:00
2021-04-19 04:02:51 +00:00
`1interact [entity id]` - interacts with that entity
2021-04-19 03:59:00 +00:00
### Authorized Commands
2021-04-19 04:18:40 +00:00
These dangerous commands can only be ran by the bot owner.
2021-04-19 03:59:00 +00:00
2021-04-19 04:02:51 +00:00
`1print [expression]` - replies with Python eval(expression)
2021-04-19 03:59:00 +00:00
2021-04-19 04:02:51 +00:00
`1exit` - exits the program
2021-03-26 22:18:46 +00:00
2021-04-21 21:47:25 +00:00
## License
This program is free and open-source software licensed under the MIT License.
Please see the `LICENSE` file for details.
That means you have the right to study, change, and distribute the software and
source code to anyone and for any purpose. You deserve these rights. Please take
advantage of them because I like pull requests and would love to see this code
put to use.
## Acknowledgements
Thanks to Isaia and the devs behind pyCraft.