Minecraft: Bedrock Edition Websocket Server
Warning
This project has been archived as there was no development in the past months. Currently, bedrockws-deno is the actively maintained library which can be used with languages in the JavaScript ecosystem. Using this Python library should be fine for basic use cases but it has the following primary issues:
- Misconception of server & client: The server does not properly handle multiple clients (see also: #13)
- Poorly designed: The API design could probably be improved heavily
If you are interested in maintaining this project, feel free to reach out on Discord or via Email. Otherwise this project may get a full or partial rewrite in the far future by myself. If you have any questions on certain aspects of how to use this library, feel free to ask and I'll do by best to answer them still.
bedrockpy lets you create a websocket server that is able to interact with a player in a Minecraft game. As the name suggests: this project only works with the "Minecraft: Bedrock Edition".
Code says more than a thousand words.
from bedrock.server import Server
app = Server()
@app.server_event
async def ready(ctx):
print(f"Ready @ {ctx.host}:{ctx.port}!")
@app.game_event
async def block_broken(ctx):
await ctx.server.run(f"title @a title Who destroyed {ctx.id}?!")
app.start("localhost", 6464)Please refer to the "Introduction" section in the documentation in order to get started with bedrockpy.
You can install/upgrade bedrockpy with the following command:
pip install -U bedrockpyIf you are not using Windows, you may as well enable uvloop which speeds up the server:
pip install -U "bedrockpy[fast]"NOT AN OFFICIAL MINECRAFT PRODUCT. NOT APPROVED BY OR ASSOCIATED WITH MOJANG.
Footnotes
-
This only applies to the client connecting to the server. ↩
