Skip to main content

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

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

Metadata

Release files for minemind 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for minemind 0.1.0
File Size Uploaded
minemind-0.1.0.tar.gz 144.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for minemind 0.1.0
File Interpreter ABI Platform
minemind-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 313.3 kB

Release files / minemind-0.1.0.tar.gz

Download URL minemind-0.1.0.tar.gz
Size 144.2 kB
Tags Source
SHA-256 checksum
How to use checksums
fafd16117a5626988429830cadec6ce3191553d8d8f1c05dc1a2aa197f66d2d3
BLAKE2b-256 checksum
How to use checksums
7eec91811ade8239157b72c18d59e42d745b3eaca9a0f27f9744dfcf81b0b753
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.0 Linux/6.5.0-1025-azure

Release files / minemind-0.1.0-py3-none-any.whl

Download URL minemind-0.1.0-py3-none-any.whl
Size 169.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
645fa1dbfe1e5d9c0e115828f547bb89e7c17ec275f8d408e6f1d7d9120a2ef2
BLAKE2b-256 checksum
How to use checksums
a9b6f5d3f04b64c26b1ab27b13482a08626793775dd7e1413a61cf96044d1756
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.0 Linux/6.5.0-1025-azure

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page