Skip to main content

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)

ScoreBoard (作成中)

scoreboard = py_mcws.ScoreBoard("名前""表示名")
await scoreboard.show()

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.0.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_mcws-1.0.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file py-mcws-1.0.2.tar.gz.

File metadata

  • Download URL: py-mcws-1.0.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for py-mcws-1.0.2.tar.gz
Algorithm Hash digest
SHA256 66045eb9b68ec6c9ef647cbd6920263656858b9c5dfeacd5bfc0b054913d8d93
MD5 8a307d750894b2fef3ec1635252a90ab
BLAKE2b-256 702d2c5d8e7392d8e37286d6509e98b156f4aec68e8ad890bd80240c816025ed

See more details on using hashes here.

File details

Details for the file py_mcws-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: py_mcws-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for py_mcws-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a5ecf0f003e11d77f2bc445dd46e99686c5f60ed72733b1285387f9081355851
MD5 4fb937e08bba825e4ea11956f1a0942c
BLAKE2b-256 aae6044ca4e5e2f5de90caa530acc3be9a427bf00d47659e236f7871309fae47

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page