Skip to main content

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

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Contact

If you have any questions, feel free to contact me via email: ivan@simantiev.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

minemind-0.1.0.tar.gz (144.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

minemind-0.1.0-py3-none-any.whl (169.2 kB view details)

Uploaded Python 3

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

Hashes for minemind-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fafd16117a5626988429830cadec6ce3191553d8d8f1c05dc1a2aa197f66d2d3
MD5 aea3c39def35d7381626b3408ed449f8
BLAKE2b-256 7eec91811ade8239157b72c18d59e42d745b3eaca9a0f27f9744dfcf81b0b753

See more details on using hashes here.

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

Hashes for minemind-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 645fa1dbfe1e5d9c0e115828f547bb89e7c17ec275f8d408e6f1d7d9120a2ef2
MD5 f45052abd4d7aff921bfa0e19d4ddb1e
BLAKE2b-256 a9b6f5d3f04b64c26b1ab27b13482a08626793775dd7e1413a61cf96044d1756

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page