Programming Minecraft with WebSockets in Python

preview_player
Показать описание
Minecraft lets you connect to a WebSocket server when you’re in a game. The server can receive and send any commands. This lets you build a bot that you can do almost anything.

This tutorial explains how to create a Python WebSocket server that Minecraft can connect to, send messages using the undocumented MCWSS protocol.

0:00 - We'll show how you can use Python to automate Minecraft
0:27 - You need Minecraft, Python, and an editor
0:56 - Import WebSockets
1:22 - Create a WebSocket server
2:40 - Connect to the WebSocket server
4:36 - Troubleshooting
6:17 - Listen to player messages
9:12 - Print player messages
10:18 - Structure of a player message response
11:14 - Listen for a "pyramid" message
14:06 - Structure of commands to set blocks
14:42 - Sending commands to set blocks
16:43 - Algorithm to draw a pyramid
20:05 - Need for queueing messages
21:24 - Create a queue for messages
24:12 - Conclusion & uses

Рекомендации по теме
Комментарии
Автор

Great video, it's been ages since I've seen a good video talking about web sockets with Minecraft, I really like how you used the websockets library compared to stdlib's socket, and your code was asynchronous too, pretty cool. Audio and video were great quality, and it was easy to follow along. Good job :)

towu
Автор

great to see someone make a professional tutorial for such an unknown thing

ocaly
Автор

To reduce the amount of entries in the queue, you can use /fill abc xyz block to do what you're doing, but this would create a structure that's not hollow, in contrast to how it is currently. To amend that, you could use two fill commands per layer, the second one with a narrower range to make it hollow, which would still be more efficient than blasting out setblock messages

towu
Автор

I don't think you need ~0 at 14:20, an integer after a special character leads to Minecraft first substituting the character for your coordinates, and then parsing the integer, so if your current position is 12 13 14, ~-1 ~2 ~3, turning into ~-1 ~+2 ~+3, then 12-1 13+2 14+3, you get your final coordinates of 11 15 17, so 0 is redundant, doesn't make much of a difference though

towu
Автор

Sir why we didn't created any environment for project?

devloper_hs
Автор

Hello, is it possible to react to command execution in a command block? For example, it would be nice when a player receives a tag.

s_smerch
Автор

Everyone who can't connect to websocket via Minecraft: You need to enable loopback to communicate with localhost in windows apps:

CheckNetIsolation LoopbackExempt -a (Powershell with Admin rights)

nicki
Автор

how can i get wss to work with my bedrock server

alexroper
visit shbcf.ru