Communauté

Olissea

Autres

[Minecraft] ComputerCraft: Code in Python!

TL;DR Control ComputerCraft remotely (aka a backdoor) with, for instance and as shown here, Python.

I really like MC and especially modded MC such as the FTB modpacks.

One of the mods often included in those packs is ComputerCraft.
A very neat "little" (not really) mod that allows you to control computers or turtles ("computers" that can move around and interact with the world). You can skip directly to the code.

But it comes at one cost (at least IMHO), you gotta control it using the programming language named Lua, which I'm very not fond of.

I really prefer Python as a programming language.

The problem?

Well, for one, the dev(s) of CC don't want to integrate (or switch over) Python in their mod.

Implementing the possibility of executing Python via CC would require to know how to mod the mod itself and thus coding in Java. meh…

(Note: Some ppl did it but I find it a bit edgy…)

My (a lil' hacky) solution?

Well, what would require the least knowledge to setup?

A "bridge"! Proxy, backdoor, … or whichever way you want to name it actually.

Yup, 20 lines of Lua and +20 lines of Python later, there you have it!

A way to control ComputerCraft turtles remotely from outside MC.

As a fact, "anything" could be used to control it but, you guessed it, I chose using Python personally.

Lua code:

local url ='http://127.0.0.1:4343/'local args =''

server_on = http.get(url..'hello/')

if server_on ==nilthenprint('PyServer is off')returnelseprint('PyServer ready')end