Low-level API for creating minecraft bots
Project description
MineMind
Low-level API for creating minecraft bots.
Supported Versions
- 1.20.3
Installation
pip install minemind
Example
Say hello world to the server.
import asyncio
from minemind.protocols.v765.bot import Bot
async def main():
async with Bot(username='Steve', host='localhost', port=25565) as bot:
await bot.chat_message('Hello, world!')
if __name__ == '__main__':
asyncio.run(main())
React to different events.
import asyncio
from minemind.dispatcher import EventDispatcher
from minemind.protocols.v765.bot import Bot
from minemind.protocols.v765.inbound.play import CollectResponse
@EventDispatcher.subscribe(CollectResponse)
async def pickup_item(data: CollectResponse):
print(f'Bot picked up {data.pickup_item_count} items')
async def main():
await Bot().run_forever()
if __name__ == '__main__':
asyncio.run(main())
Get server information.
import asyncio
from minemind.client import Client
from minemind.protocols.v765.server import Server
async def main():
async with Client(host='localhost', port=25565) as client:
server = Server(client)
print(await server.get_info())
if __name__ == '__main__':
asyncio.run(main())
Documentation
TBD
Testing
To test your bot, you can start simple local server using docker (it's using itzg/minecraft-server image):
docker-compose up
Debugging
Library provides three levels of debugging:
- [DEBUG=3] DEBUG_GAME_EVENTS: Print game events, like player movement, chat messages, damage received, etc.
- [DEBUG=2] DEBUG_PROTOCOL: Print all protocol messages, like handshaking, received events, map loading, etc. + DEBUG_GAME_EVENTS
- [DEBUG=1] DEBUG_TRACE: Lower socket level debugging, like connection status, sent and received packets, etc. + DEBUG_PROTOCOL
You can set the debug level by setting the environment variable DEBUG to one of the values above, e.g. to set debug level to DEBUG_PROTOCOL:
DEBUG=2 python my_script.py
Roadmap
- Physics engine
- Bot movement
- Elytra flight
- Combat system
- Mining
- Inventory management
- Item interaction (e.g. bed, crafting table, etc.)
- Implement crafting
- Pathfinding
- Fishing
- Documentation
- Unit-tests
- Dynamic version support
Useful links
- Minecraft protocol documentations: https://wiki.vg/Protocol_version_numbers
- Minecraft data (e.g. entities, protocol schema, etc.): https://github.com/PrismarineJS/minecraft-data/
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Contact
If you have any questions, feel free to contact me via email: ivan@simantiev.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file minemind-0.1.0.tar.gz.
File metadata
- Download URL: minemind-0.1.0.tar.gz
- Upload date:
- Size: 144.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.0 Linux/6.5.0-1025-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fafd16117a5626988429830cadec6ce3191553d8d8f1c05dc1a2aa197f66d2d3
|
|
| MD5 |
aea3c39def35d7381626b3408ed449f8
|
|
| BLAKE2b-256 |
7eec91811ade8239157b72c18d59e42d745b3eaca9a0f27f9744dfcf81b0b753
|
File details
Details for the file minemind-0.1.0-py3-none-any.whl.
File metadata
- Download URL: minemind-0.1.0-py3-none-any.whl
- Upload date:
- Size: 169.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.0 Linux/6.5.0-1025-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
645fa1dbfe1e5d9c0e115828f547bb89e7c17ec275f8d408e6f1d7d9120a2ef2
|
|
| MD5 |
f45052abd4d7aff921bfa0e19d4ddb1e
|
|
| BLAKE2b-256 |
a9b6f5d3f04b64c26b1ab27b13482a08626793775dd7e1413a61cf96044d1756
|