8ce0defe8afc
Clean up out.clj.
author | Steve Losh <steve@stevelosh.com> |
---|---|
date | Thu, 21 Jul 2011 18:42:21 -0400 |
parents | 5b451989308a |
children | 827c992e7b65 |
branches/tags | (none) |
files | src/clojurecraft/core.clj src/clojurecraft/out.clj |
Changes
--- a/src/clojurecraft/core.clj Thu Jul 21 18:23:11 2011 -0400 +++ b/src/clojurecraft/core.clj Thu Jul 21 18:42:21 2011 -0400 @@ -89,7 +89,7 @@ ; Scratch -------------------------------------------------------------------------- ;(def bot (connect minecraft-local)) -;(act/move bot 4 0 2) +;(act/move bot 2 0 0) ;(pprint @(:packet-counts-in bot)) ;(pprint @(:packet-counts-out bot)) ;(pprint (:player bot))
--- a/src/clojurecraft/out.clj Thu Jul 21 18:23:11 2011 -0400 +++ b/src/clojurecraft/out.clj Thu Jul 21 18:42:21 2011 -0400 @@ -4,48 +4,38 @@ ; Writing Data --------------------------------------------------------------------- (defn- -write-byte [conn i] - (doto (:out @conn) - (.writeByte (int i)))) + (io! (.writeByte (:out @conn) (int i)))) (defn- -write-bytearray [conn ba] - (doto (:out @conn) - (.write ba 0 (count ba)))) + (io! (.write (:out @conn) ba 0 (count ba)))) (defn- -write-short [conn i] - (doto (:out @conn) - (.writeShort (short i)))) + (io! (.writeShort (:out @conn) (short i)))) (defn- -write-shortarray [conn sa] - (map #(-write-short %) sa)) + (doall (map #(-write-short %) sa))) (defn- -write-int [conn i] - (doto (:out @conn) - (.writeInt (int i)))) + (io! (.writeInt (:out @conn) (int i)))) (defn- -write-long [conn i] - (doto (:out @conn) - (.writeLong (long i)))) + (io! (.writeLong (:out @conn) (long i)))) (defn- -write-double [conn i] - (doto (:out @conn) - (.writeDouble (double i)))) + (io! (.writeDouble (:out @conn) (double i)))) (defn- -write-float [conn i] - (doto (:out @conn) - (.writeFloat (float i)))) + (io! (.writeFloat (:out @conn) (float i)))) (defn- -write-string-utf8 [conn s] - (doto (:out @conn) - (.writeUTF s))) + (io! (.writeUTF (:out @conn) s))) (defn- -write-string-ucs2 [conn s] (-write-short conn (count s)) - (doto (:out @conn) - (.writeChars s))) + (io! (.writeChars (:out @conn) s))) (defn- -write-bool [conn b] - (doto (:out @conn) - (.writeBoolean b))) + (io! (.writeBoolean (:out @conn) b))) (defn- -write-metadata [conn m] ; TODO: Implement this.