Skip to main content

Mineflex

A native Python implementation of a Minecraft bot framework, inspired by and behaviorally compatible with Mineflayer.

Overview

Mineflex provides a Pythonic API for creating Minecraft bots with asyncio support, designed to offer the same fundamental capabilities and developer experience as Mineflayer while leveraging Python's strengths.

Target Usage

import asyncio
from mineflex import create_bot

async def main():
    bot = create_bot(
        host="localhost",
        port=25565,
        username="Bot",
        auth="offline",
        version="auto",
    )

    @bot.on("chat")
    async def on_chat(username, message, *args):
        if username != bot.username:
            await bot.chat(message)

    @bot.on("spawn")
    async def on_spawn(*args):
        print("Bot spawned:", bot.username)

    await bot.run()

if __name__ == "__main__":
    asyncio.run(main())

Features

Mineflex aims to provide feature parity with Mineflayer, including:

  • Minecraft protocol implementation
  • Entity knowledge and tracking
  • Block knowledge and world queries
  • Physics and movement simulation
  • Inventory management
  • Crafting, chests, and containers
  • Digging and building
  • Health, food, and status tracking
  • Chat and messaging
  • Plugin system for extensibility

Architecture

Mineflex is designed as a modular, native Python implementation with clear separation of concerns:

  • Protocol Layer: Minecraft protocol parsing/serialization
  • Client Layer: Network connection and packet handling
  • World Layer: Chunks, blocks, biomes, and spatial queries
  • Entity Layer: Entity tracking and state management
  • Physics Layer: Movement simulation and collision detection
  • Inventory Layer: Items, slots, and container management
  • Actions Layer: Digging, building, combat, and interaction
  • Chat Layer: Message parsing and component handling
  • Authentication Layer: Offline and Microsoft authentication
  • Plugin System: Extensibility and lifecycle management

Development Status

Current Status: Foundation Complete (Phase 7)

Mineflex has completed its foundational implementation with 171 passing unit tests across all major subsystems:

  • ✅ Protocol Layer: Codecs, packet definitions, connection handling
  • ✅ Client Layer: Connection, keepalive, packet handler
  • ✅ World Layer: Chunks, blocks, biomes, heightmaps, spatial queries
  • ✅ Entity Layer: Entity tracking, player entities, nearest entity search
  • ✅ Physics Layer: Movement simulation, collision detection, gravity
  • ✅ Inventory Layer: Items, slots, windows, container management
  • ✅ Crafting Layer: Recipe management, crafting feasibility checking
  • ✅ Actions Layer: Action primitives (dig, build, use_item, attack)
  • ✅ Plugin System: Plugin lifecycle management and extensibility
  • ✅ Event System: Async event emitter with handler management

Limitations: This is an early implementation. Real-server integration, full protocol support, Microsoft authentication, and many Mineflayer features are not yet implemented. See docs/COMPATIBILITY_REPORT.md for detailed status.

Installation

pip install mineflex

Documentation

License

MIT License - See LICENSE file

Acknowledgments

Mineflex is inspired by and aims for behavioral compatibility with Mineflayer and the PrismarineJS ecosystem. This is an independent Python implementation, not a translation or wrapper.

Release files for mineflex 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 mineflex 0.1.0
File Size Uploaded
mineflex-0.1.0.tar.gz 79.2 kB Details

Built distribution (wheel)

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

Total release size: 164.1 kB

Release files / mineflex-0.1.0.tar.gz

Download URL mineflex-0.1.0.tar.gz
Size 79.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4b13893b8d9714fff8544f2ddfbb5f118e18a8884dd753bb8233f66c0554ae55
BLAKE2b-256 checksum
How to use checksums
a1505ba556f16e447893a87f9b44f4065776a79c9ecb8c19e6259015197e0127
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

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

Download URL mineflex-0.1.0-py3-none-any.whl
Size 85.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d60297063756a05e141b759f8da184783ec20425866efbd9f7fcd7635a8c33eb
BLAKE2b-256 checksum
How to use checksums
0ae011817609cdd274c72abc82c7e50603810ac4d8c850cfb8fc4cfb81a487aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

0.1.1

2 release files

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