# HG changeset patch # User Steve Losh # Date 1313197822 14400 # Node ID f03a74a0782c790b1b3fd9258bdf36af381fba5f # Parent 32e1c608e92749a77acd15fe1d4b91df07942517 Respawn action. diff -r 32e1c608e927 -r f03a74a0782c docs/source/actions.rst --- 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. diff -r 32e1c608e927 -r f03a74a0782c src/clojurecraft/actions.clj --- 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. diff -r 32e1c608e927 -r f03a74a0782c src/clojurecraft/out.clj --- 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))