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.

Install

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=685)
bot.chat("hello")
bot.command("/say hello")

Telegram controller

The package includes a dependency-free Telegram long-polling controller:

export TELEGRAM_BOT_TOKEN="set-this-as-a-Replit-Secret"
# Optional: restrict access to comma-separated Telegram chat IDs.
export TELEGRAM_ALLOWED_CHAT_IDS="123456789"
bedrock-telegram

Send /server HOST PORT USERNAME in Telegram, then use the interactive buttons to connect, check status, send chat, send commands, or disconnect.

Command line

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

Python

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. A signed login-chain payload is intentionally passed into ClientSession.begin_login() so applications can choose their identity provider without the library fabricating credentials.

Author

ZENKAI

Development

python -m pytest
python -m build

For local development, install the optional tooling with:

pip install -e ".[dev]"

MIT licensed.

Metadata

Release files for pybedrock-net 0.5.3

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

Built distribution (wheel)

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

Total release size: 84.6 kB

Release files / pybedrock_net-0.5.3.tar.gz

Download URL pybedrock_net-0.5.3.tar.gz
Size 35.1 kB
Tags Source
SHA-256 checksum
How to use checksums
75165729d937d2c1038183771b259c03e1331ac870a7eef45dd14b680ccf6305
BLAKE2b-256 checksum
How to use checksums
f5364c66aa72c7508bc529564b00de09fa20336b913c015a7b17fd7292750bfe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.11

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

Download URL pybedrock_net-0.5.3-py3-none-any.whl
Size 49.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f9408218770116484258d651f0eed6d2adef7627fa7f2909b3bb77f30036fe22
BLAKE2b-256 checksum
How to use checksums
4a7d757bf154b6b137431f20aad37e7a48a687aaa0a2a3b4df1b568155415191
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.11

Security for pybedrock-net 0.5.3

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

0.5.3 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