Skip to main content

pybedrock-net ⛏️🚀

PyPI version License: MIT Python 3.9+ Platform

The 100% Pure Python, Non-Native Engine for Minecraft Bedrock (MCPE) & RakNet Networking.
Developed and maintained by zenkai.


⚡ Why pybedrock-net?

If you have ever attempted to build or run a Minecraft Bedrock bot in Docker, Linux containers, or cloud servers, you likely encountered the infamous compilation nightmare:

Error: Could not locate the bindings file. Tried: .../node-raknet.node
ERR! C++ Compiler toolset is not available.

pybedrock-net solves this completely. It is built from the ground up using pure asynchronous Python UDP networking, meaning:

  • Zero C++ Compilers Required: No gcc, no cmake, no native binary bindings that crash across different Node or Python ABI versions.
  • Runs Everywhere: Works on Linux, Windows, macOS, Docker, Cloud Run, Raspberry Pi, and Android Termux out of the box.
  • Production-Tested In-World Protocol: Handles the entire Bedrock connection lifecycle—RakNet MTU negotiation, login tokens, multi-phase resource pack verification, game spawn, real-time coordinate tracking, and automated keepalive.

🚀 Installation

Install the latest release from PyPI:

pip install pybedrock-net

Or install directly from the source repository:

git clone https://github.com/zenkai/pybedrock-net.git
cd pybedrock-net
pip install -e .

💻 CLI Usage (pybedrock-bot)

pybedrock-net comes bundled with a full-featured terminal CLI client:

# Ping a Bedrock server
pybedrock-bot --ping --host play.example.com --port 19132

# Connect a bot to a server with Anti-AFK enabled
pybedrock-bot --host play.example.com --port 19132 --username ZENKAI_Bot --anti-afk

CLI Arguments

Argument Description Default
--host Target Bedrock server hostname or IP Required
--port Target UDP port 19132
--username Bot gamer tag ZENKAI_Bot
--ping Ping server and display MOTD without logging in False
--anti-afk Automatically swing arm & move to prevent idle kicks True
--view-distance Chunk radius requested from server 10

🐍 Python API Examples

1. Ping and Query Server Status

import asyncio
from pybedrock_net import BedrockServerPing

async def main():
    info = await BedrockServerPing.query("play.example.com", port=19132, timeout=3.0)
    if info.online:
        print(f"MOTD: {info.motd}")
        print(f"Version: {info.version} (Protocol {info.protocol})")
        print(f"Players: {info.players_online}/{info.players_max}")
        print(f"Latency: {info.latency}ms")
    else:
        print("Server is offline or unreachable.")

asyncio.run(main())

2. Spawning a Bot into the World

import asyncio
from pybedrock_net import BedrockClient

async def main():
    bot = BedrockClient(
        host="play.example.com",
        port=19132,
        username="ZENKAI_Agent",
        anti_afk=True
    )

    @bot.on("connect")
    async def on_connect():
        print("Connected to RakNet UDP layer!")

    @bot.on("login")
    async def on_login():
        print("Authentication succeeded! Negotiating resource packs...")

    @bot.on("spawn")
    async def on_spawn(data):
        print(f"Bot spawned into the world! Dimension: {data.dimension}")
        print(f"Position: X={data.position.x}, Y={data.position.y}, Z={data.position.z}")
        # Send a greeting into the server chat
        await bot.send_chat("Hello everyone! Powered by pybedrock-net.")

    @bot.on("chat")
    async def on_chat(sender, message):
        print(f"[{sender}] {message}")
        if message == "!ping":
            await bot.send_chat("Pong!")

    await bot.start()

asyncio.run(main())

🏛️ Architecture & Protocol Stack

┌───────────────────────────────────���──────────┐
│           High-Level Bot API                 │
│      (Events, Chat, Actions, Anti-AFK)       │
├──────────────────────────────────────────────┤
│         Bedrock Protocol Layer (v1.20+)      │
│  (Login, Packs, StartGame, TickSync, Latency)│
├──────────────────────────────────────────────┤
│           Pure Python RakNet Engine          │
│    (MTU Discovery, Encapsulation, ACK/NACK)  │
├──────────────────────────────────────────────┤
│           Asyncio Datagram Socket (UDP)      │
└──────────────────────────────────────────────┘

📦 Publishing to PyPI

To build and publish new distributions to PyPI:

# 1. Install build dependencies
python -m pip install --upgrade build twine

# 2. Build distribution archives
python -m build

# 3. Upload to PyPI
twine upload dist/*

👨‍💻 Author & Community

pybedrock-net was created and is actively maintained by zenkai.

GitHub TikTok Repository Email

Feel free to submit pull requests, open issues, or reach out for custom Minecraft Bedrock network integrations and bot solutions.


📄 License

Distributed under the MIT License. See LICENSE for details.

Developed with precision by zenkai.

Metadata

Release files for pybedrock-net 1.3.1

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

Source distribution (sdist)

Source distribution for pybedrock-net 1.3.1
File Size Uploaded Provenance Actions
pybedrock_net-1.3.1.tar.gz 20.9 kB Without provenance Details for pybedrock_net-1.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pybedrock-net 1.3.1
File Interpreter ABI Platform Actions
pybedrock_net-1.3.1-py3-none-any.whl Python 3 none any Details for pybedrock_net-1.3.1-py3-none-any.whl

Total release size: 40.0 kB

Release files / pybedrock_net-1.3.1.tar.gz

Download URL pybedrock_net-1.3.1.tar.gz
Size 20.9 kB
Tags Source
SHA-256 checksum
How to use checksums
bebf093bdb136c90e0b8b62a6a52d40eca4dcd87e2a7ce808ecd8ab4b2116faa
BLAKE2b-256 checksum
How to use checksums
6adbeb4e133e214f50f9422b562b38062fc1fd5970921cf81ef633d2e46ee8df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / pybedrock_net-1.3.1-py3-none-any.whl

Download URL pybedrock_net-1.3.1-py3-none-any.whl
Size 19.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73d2cf6e1276f47d831ddaddd19e50bd7b41ae5a8b6c1b86648778769b39d6cd
BLAKE2b-256 checksum
How to use checksums
efc1d63be5d47343e4386decd592d3fa837d18a20000d7e7db812dedb7f1c63f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Security for pybedrock-net 1.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.3.1 This release

2 release files No provenance

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