Skip to main content

PyBedrock Net

PyPI version Downloads Python Bedrock Protocol License: MIT

PyBedrock Net is a high-performance Python networking toolkit for building Minecraft Bedrock Edition clients, autonomous bots, server discovery tools, and protocol security experiments. Created and maintained by ZENKAI, it delivers production-grade async RakNet and Bedrock protocols with zero C++ compiler dependencies.

The project is organized around the complete Bedrock client journey:

  • Client and sessions — simple client configuration, connection lifecycle, and reusable sessions.
  • RakNet and transport — UDP transport, connection handling, reliability, fragmentation, compression, and packet flow.
  • Protocol and packets — codecs, VarInts, readers, writers, registries, version resolution, handshakes, login, gameplay, movement, chat, commands, inventory, player, and world packets.
  • Authentication — offline mode (cracked) plus official Microsoft/Xbox account authentication token management.
  • World data & Map Art — chunks, subchunks, palettes, blocks, schematics, and 2b2t-style ground map art printing.
  • Entities and players — entity models, metadata, real-time tracking, 3D LookAt, and player state.
  • Bots and automation — movement, mining, combat, reactive defense, anti-AFK, and controllers.
  • Events and discovery — event dispatching, server ping, and auto-protocol detection.

⚡ 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 of native C++ bindings:

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.

🆕 What's New in v1.4.2 (Verified In-World Spawn Release)

  • 🌟 Verified World Spawn Engine (SetLocalPlayerAsInitialized 0x71):

    • Fixes the classic Bedrock bot trap where a bot connects to RakNet but stays stuck in the loading dimension.
    • Automatically sends SET_LOCAL_PLAYER_AS_INITIALIZED (Packet ID 0x71 / 113) with runtime_entity_id and tick synchronization upon receiving StartGame, transitioning immediately to active IN_WORLD state (PlayStatus == 3).
  • 🤖 First-Class BedrockBot & LoginChainBuilder Architecture:

    • Added native pybedrock_net.bot.BedrockBot for one-liner bot scripts:
      from pybedrock_net.bot import BedrockBot
      
      bot = BedrockBot("bedrock.donutsmp.net", 19132, "ZENKAI_Bot")
      bot.login()
      bot.chat("ZENKAI in the world!")
      
    • Added native pybedrock_net.auth.LoginChainBuilder for custom JWT identities and offline skin generation.
  • 🧪 100% Verified Automated Test Suite:

    • Fixed test version expectations and added regression tests for packet framing, player actions, and auth chain builders.
  • 🌐 Universal Auto-Protocol Sniffer (v1.19.30 through 1.21.60+):

    • Automatically queries Bedrock servers via RakNet Unconnected Ping and detects exact protocol versions (544 up to 776+).
    • Dynamically aligns packet handshakes and network compression on the fly.
    • Zero "Outdated Client" kicks on servers like DonutSMP, Aternos, NetherGames, and CubeCraft.
  • ⚡ Tactical Action Packets (PlayerAction 0x24):

    • client.start_mining(x, y, z) and client.stop_mining(x, y, z) for terrain flattening.
    • client.respawn() automated instant revive upon death.
    • client.swing_arm() attack and block interaction.
    • client.look_at(x, y, z) 3D vector pitch & yaw target calculation.

📜 Previous Highlights from v1.3.4

  • ⚔️ Extended Combat AI & Reactive Self-Defense:

    • client.attack(entity_id) and reactive counter-attack loop.
    • Automatic target lock-on: strikes attacker until eliminated, then immediately halts (Stop on Kill).
    • Creative God-Mode resilience: ignores damage knockback and maintains offensive priority.
  • 👀 Eye-Contact Detection & Respectful Greeting:

    • Bot automatically calculates pitch/yaw to detect when a player is directly looking at it.
    • Automatically faces the player and performs a courteous bow (client.sneak(True)).
  • 🌐 Global Multi-Server Player Tracker:

    • Track any player across Bedrock & Java public networks worldwide.
    • Resolves player presence, server coordinates (when co-located), join time, UUID, and server details.
  • 🕹️ Interactive Telegram Bot Controller:

    • Full inline interactive button matrix for remote bot actions:
      • 📷 Live POV Camera Snapshot
      • 👥 List Online Players
      • 🔍 Global Player Tracker
      • ⚔️ PvP Combat Retaliation
      • 🙇 Respectful Bow Greeting
      • 🛡️ Creative God-Mode Toggle
      • 🏃 Anti-AFK Jump & Roam

🚀 Installation

pip install pybedrock-net

The package is published on PyPI at https://pypi.org/project/pybedrock-net/.

To create a signed login payload:

from pybedrock_net.auth import LoginChainBuilder

login = LoginChainBuilder().build(
    server_address="play.example.com:19132",
    display_name="PyBot",
)
session.begin_login(2169, login.payload())

🤖 Offline bot

For an offline-mode server, the username is selected locally and no Microsoft account is used:

from pybedrock_net.bot import BedrockBot

bot = BedrockBot("127.0.0.1", 19132, "AnyName")
bot.login(protocol=776) # Bedrock 1.21.60
bot.chat("hello world")
bot.command("/say hello")

# Combat & Interaction
bot.sneak(True) # Bow greeting
bot.attack(target_id=123)

📱 Telegram controller

The package includes a dependency-free Telegram long-polling controller with rich inline buttons:

export TELEGRAM_BOT_TOKEN="your_telegram_bot_token"
export TELEGRAM_ALLOWED_CHAT_IDS="123456789"
bedrock-telegram

Send /server HOST PORT USERNAME in Telegram, then use the interactive button keyboard to view live camera snapshots, list online players, track users globally, attack, bow, or disconnect.

💻 Command line

bedrock-ping play.example.com
bedrock-ping play.example.com --port 19132 --timeout 5

🐍 Python Client

from pybedrock_net import BedrockClient

client = BedrockClient("play.example.com", 19132)
status = client.ping()
print(status.description, status.players_online, "/", status.players_max)

Discovery ping is available through client.ping(), but connection setup skips it by default because some proxies and firewalls block unconnected RakNet pings. To require discovery before the RakNet handshake:

client = BedrockClient("play.example.com", skip_ping=False)
session = client.connect()

The current release provides a real RakNet unconnected ping/pong flow, a reusable UDP transport, binary codecs, server status parsing, connected RakNet batch send/receive, Microsoft/Xbox device-code authentication, and client/bot session foundations.


ZENKAI

📄 License

MIT License - Copyright (c) 2026 PyBedrock Net contributors.

Metadata

Release files for pybedrock-net 1.4.2

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.4.2
File Size Uploaded Provenance Actions
pybedrock_net-1.4.2.tar.gz 30.2 kB Without provenance Details for pybedrock_net-1.4.2.tar.gz

Release files / pybedrock_net-1.4.2.tar.gz

Download URL pybedrock_net-1.4.2.tar.gz
Size 30.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e7e4c9e0196c886c20cb27b898ca17a60fc3f8a0f01e2f4e96a37ed0dde7a953
BLAKE2b-256 checksum
How to use checksums
6dc46dbba447eed5b9f0ebb2f0222bcd79f149fdff80b16a0909c2525c85d626
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2

Security for pybedrock-net 1.4.2

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.4.2 This release

1 release file 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