vanheusden.com

minecraft

HTTP/XMPP interface

I created an XMPP/HTTP interface to Minecraft using the Botcraft library. XMPP is like Signal and WhatsApp but then more open.

When you add the user testbot@komputilo.nl to your XMPP client, you can send it commands like "help", "screenshot", "move x y z", etc.

The code for this is in the 'fvh'-branch of my Botcraft-fork (under Examples/HTTP_XMPP_gateway). For this I added a HTTP-listener to a botcraft-bot talking RPC. RPC is "remote procedure call", a way of interacting with a service (e.g. over HTTP), see Wikipedia. This HTTP-listener is connected to XMPP via a Python script. Everything can be found in the GitHub repository.

RPC invocations

http://localhost:8080/state returns the state of the player, e.g.:

curl http://localhost:8080/state


{
  "x": -59.684955,
  "y": 70,
  "z": -69.728208,
  "pitch": 0,
  "yaw": 316.026855,
  "is-on-ground": true,
  "is-flying": false,
  "may-fly": true,
  "is-climbing": false,
  "is-in-water": false,
  "is-in-lava": false,
  "is-in-fluid": false,
  "insta-build": true,
  "may-build": false,
  "flying-speed": 0.05,
  "walking-speed": 0.1,
  "health": 20,
  "food-saturation": 5,
  "food": 20
}

http://localhost:8080/dig, /move-to, /relative-move, /look-at and /interact require an x, y and z parameter. For example with cURL this looks like:

curl -X POST -d 'x=123' -d 'y=98' -d 'z=101'  http://localhost:8080/dig

The most interesting one(?) is probably the /screenshot invocation. This returns a PNG file that you can view directly in e.g. your browser:

curl -O screenshot.pnt http://localhost:8080/screenshot

MIDI sequencer

This script (sequencer.py) is a MIDI percussion sequencer in minecraft.

When it runs, it draws a panel in which you can put blocks to indicate that a certain instrument must be played at a certain time.

The sounds are played via a local MIDI synthesizer (e.g. fluidsynth). For that you need to connect sequencer.py to the input-port of fluidsynth or of a physical midi port. This can be accomplished using with for example patchage.

screenshot:


The torch indicates the start of the sequence and the 'glow stone' is the current position in the sequence (the one being played).

On Youtube there is a preview.

a fancy clock



The three bright blocks tell you the hour, minutes and seconds (real time): clock.py.

playermap

This thing shows the location of the players in my minecraft-server.

The dots visualize the position of each player versus a reference player (called "McAutoBot123" (a bot indeed)). Their color indicate how fast they’re moving (white is stationary).

It also announces new users.

This thing is build-up of a HUB-75 64x32 pixel display, an ESP32 and 2,5A powersupply (should be enough for 30+ players) and a letterbox. In the ESP there’s a program which receives pixelflood/pixelflut packets via udp over wifi. On the (minecraft-)server side there’s a python script which renders frames and sends those to the box.

game of life

Using pyncraft in spigot I created a small game-of-life python-script for minecraft: game-of-life.py.

The result looks like (6 frames only):




For contact info, see this page.


bad crawlers