f03a74a0782c
Respawn action.
author | Steve Losh <steve@stevelosh.com> |
---|---|
date | Fri, 12 Aug 2011 21:10:22 -0400 |
parents | 32e1c608e927 |
children | 82b346fcfbf2 |
branches/tags | (none) |
files | docs/source/actions.rst src/clojurecraft/actions.clj src/clojurecraft/out.clj |
Changes
--- a/docs/source/actions.rst Fri Aug 12 20:53:57 2011 -0400 +++ b/docs/source/actions.rst Fri Aug 12 21:10:22 2011 -0400 @@ -55,3 +55,11 @@ This action is fairly low level. Expect to see some fun path-finding algorithms/libraries in the future that will remove the need to call this directly. + +respawn +------- + +``(clojurecraft.actions/respawn bot)`` + +The ``respawn`` action tells your bot to respawn. Only send this if your bot has +died, because I'm not sure what the vanilla server will do otherwise.
--- a/src/clojurecraft/actions.clj Fri Aug 12 20:53:57 2011 -0400 +++ b/src/clojurecraft/actions.clj Fri Aug 12 21:10:22 2011 -0400 @@ -26,3 +26,7 @@ (defn chat [bot message] (delay (write-packet bot :chat {:message message}))) + +(defn respawn [bot] + (delay + (write-packet bot :respawn {:world 0}))) ; Always respawn in the normal (non-Nether) world for now.
--- a/src/clojurecraft/out.clj Fri Aug 12 20:53:57 2011 -0400 +++ b/src/clojurecraft/out.clj Fri Aug 12 21:10:22 2011 -0400 @@ -59,7 +59,7 @@ (-write-string-ucs2 conn message)) (defn- write-packet-respawn [conn {world :world}] - (-write-bool conn world)) + (-write-byte conn world)) (defn- write-packet-player [conn {onground :onground}] (-write-bool conn onground))