Skip to content

Instantly share code, notes, and snippets.

Created June 10, 2013 01:15
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
trying to write a library for interacting with the Minecraft Pi Edition API
(define-values (mc-in mc-out) (tcp-connect "192.168.1.31" 4711))
(define (args->strings loa)
(cond
[(empty? loa) empty]
[else (cons (~a (first loa)) (args->strings (rest loa)))]))
(define (process-args loa)
(string-join (args->strings loa) ","
#:before-first "("
#:after-last ") #\newline"))
(define (send-command cmd-string args)
(display (string-append cmd-string (process-args args)) mc-out)
(flush-output mc-out))
(define (get-block x y z)
(send-command "world.getBlock" (list x y z))
(read-line mc-in))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment