Skip to main content

PyBedrock Net

PyBedrock Net is a Python networking toolkit for building Minecraft Bedrock Edition clients, bots, server tools, and protocol experiments. It is created and maintained by ZENKAI with a focus on a clean API, simple scripts, and protocol code that can grow without becoming difficult to use.

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 plus the foundations for Microsoft/Xbox account sessions and token management.
  • World data — chunks, subchunks, palettes, blocks, cache, and world state.
  • Entities and players — entity models, metadata, tracking, and player state.
  • Bots and automation — movement, navigation, actions, and controllers.
  • Events and discovery — event dispatching, server ping, and protocol detection.

The package is intentionally built in tested layers: low-level binary primitives first, then transport and protocol packets, then high-level client and bot APIs. This makes it useful for both a quick server script and a larger Bedrock automation project.


⚡ 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.3.4 (Latest Production Release)

  • ⚔️ 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
  • 📡 Extended Protocol 776 (Minecraft Bedrock 1.21.60+):

    • Support for Bedrock protocols from 685 (1.20.80) through 776 (1.21.60) with automated protocol negotiation fallback.

🚀 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.3.4

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.4
File Size Uploaded Provenance Actions
pybedrock_net-1.3.4.tar.gz 15.4 kB Without provenance Details for pybedrock_net-1.3.4.tar.gz

Built distribution (wheel)

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

Total release size: 34.4 kB

Release files / pybedrock_net-1.3.4.tar.gz

Download URL pybedrock_net-1.3.4.tar.gz
Size 15.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3786fcb9d4fc255e146bf893adf2063d0ea302c53ee4b1d72c9bbd136256a753
BLAKE2b-256 checksum
How to use checksums
dd4944bd0dbb15c4a9aab5cc467e3b17dc016067324de27bc9c7335a49d91a0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0

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

Download URL pybedrock_net-1.3.4-py3-none-any.whl
Size 19.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03f2df4fe42dda3bf494c148897447c0fb5c31a0af6a614e9cbf50322c7fc2ca
BLAKE2b-256 checksum
How to use checksums
9f802d12dbe94dac392d91bbf22af00608ab502ff0d224223221de58a64498e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0

Security for pybedrock-net 1.3.4

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