neumond / python-computer-craft

Pythonization of ComputerCraft Minecraft mod. Write Python instead Lua!
MIT License
69 stars 7 forks source link

Server usage? #4

Closed spookybear0 closed 3 years ago

spookybear0 commented 3 years ago

is it possible to use this on a server? if so, how. (using CC tweaked)

neumond commented 3 years ago

It's possible. Run python -m computercraft.server on the same machine with server, then in game write wget http://127.0.0.1:8080/ py. 127.0.0.1 is the same-machine IP address. Note that you'll have to enable 127.0.0.1 in server config.

Same way, you may host python server anywhere else, even on another remote machine, with it's own IP address (looking like 52.18.1.188), or even it's own domain (like yourdomain.example.org). Of course you'll have to write in game wget http://52.18.1.188:8080/ py or wget http://yourdomain.example.org:8080/ py

I have to warn you: this is not secure. Any player may import os and execute arbitrary code on your server. It's better to wrap python server in docker container, or at least run it as unprivileged user.

spookybear0 commented 3 years ago

Thanks for replying so fast, I got it working running it on my VPS (as I use a minecraft hosting for the mc server). It should be fine as I am playing with friends, thanks!