src/examples/jumpbot.clj @ d7d867712163
Update to Clojure 1.4 and Leiningen 2.
author |
Steve Losh <steve@stevelosh.com> |
date |
Thu, 31 May 2012 18:37:33 -0400 |
parents |
eb08d252e542 |
children |
(none) |
(ns examples.jumpbot
(:require [clojurecraft.core :as core])
(:require [clojurecraft.events :as events])
(:require [clojurecraft.loops :as loops])
(:require [clojurecraft.actions :as actions]))
(defn jump [bot]
[(actions/jump bot)])
(defn handle-dead [bot]
[(actions/chat bot "WHY DO YOU NOT WANT ME TO JUMP?!")
(actions/respawn bot)])
(defn make-jumpbot [server username]
(let [bot (core/connect server username)]
(events/add-handler bot :dead #'handle-dead)
(loops/add-loop bot #'jump 2000 :jump-loop)
bot))
(require '(clojurecraft [core :as core] [actions :as actions]))
(def bot (make-jumpbot core/minecraft-local "jimmy"))
(core/disconnect bot)