Minecraft Bedrock WebSocket
Project description
py-mcws
MinecraftとPythonを繋げるためのパッケージ
インストール
pip install py-mcws
使い方
import py_mcws
class MyWsClient(py_mcws.WsClient):
def event_ready(self):
print(f"Ready {self.host}:{self.port}")
#受け取るイベント
self.events = ["PlayerMessage", "PlayerDied"]
async def event_connect(self):
print("Connected!")
#コマンドを実行
await self.command("say Hello")
async def event_disconnect(self):
print("disconnect!")
async def event_PlayerMessage(self, event):
print(event)
async def event_PlayerDied(self, event):
print(event)
MyWsClient().start(host="0.0.0.0", port=19132)
接続の仕方
Minecraft内のチャットで
/connect host:port
イベント
self.events["PlayerMessage"]
async def event_PlayerMessage(self, event):
print(event)
コマンド
cmd = await self.command("say hello")
print(cmd)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py-mcws-1.1.2.tar.gz
(3.6 kB
view hashes)