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/*

📄 License

Distributed under the MIT License. See LICENSE for details.

Developed with precision by zenkai.

Metadata

Release files for pybedrock-net 1.3.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 pybedrock-net 1.3.0
File Size Uploaded Provenance Actions
pybedrock_net-1.3.0.tar.gz 19.7 kB Without provenance Details for pybedrock_net-1.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 38.0 kB

Release files / pybedrock_net-1.3.0.tar.gz

Download URL pybedrock_net-1.3.0.tar.gz
Size 19.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4338ebde746b26d890dd4038da66c881eb7aa16de1b9274c07a6a58dcf28ce4b
BLAKE2b-256 checksum
How to use checksums
67745970475cc093bcc83e7869173d90cc40e76286c0ea2ab0c9cd71d1dfc91d
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.0-py3-none-any.whl

Download URL pybedrock_net-1.3.0-py3-none-any.whl
Size 18.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3d0ea518baa43970d97516d88337e827a74c18282ab3a723fb4ff20348d9d8fb
BLAKE2b-256 checksum
How to use checksums
7d4dc88087a5c3633373fc9588d555c3b584e8d31af32fa1b4a462888cd51643
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.0

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.0 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