trying to write a library for interacting with the Minecraft Pi Edition API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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