a5dd7fa97088

Moar.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 21 Jun 2011 21:01:51 -0400
parents cce62e009da0
children 77024563a900
branches/tags (none)
files src/clojurecraft/core.clj

Changes

--- a/src/clojurecraft/core.clj	Tue Jun 21 20:59:56 2011 -0400
+++ b/src/clojurecraft/core.clj	Tue Jun 21 21:01:51 2011 -0400
@@ -12,6 +12,7 @@
      0x03 :chat 
      0x04 :timeupdate 
      0x05 :equipment 
+     0x06 :spawnposition
 })
 (def packet-ids (apply assoc {} (mapcat reverse packet-types)))
 
@@ -152,6 +153,12 @@
           (assoc :itemid (-read-short conn))
           (assoc :unknown (-read-short conn))))
 
+(defn read-packet-spawnposition [conn]
+      (-> {}
+          (assoc :x (-read-int conn))
+          (assoc :y (-read-int conn))
+          (assoc :z (-read-int conn))))
+
 
 (defn read-packet [conn packet-id]
       (let [packet-id (int packet-id)
@@ -165,6 +172,7 @@
             (= packet-type :chat) (read-packet-chat conn)
             (= packet-type :timeupdate) (read-packet-timeupdate conn)
             (= packet-type :equipment) (read-packet-equipment conn)
+            (= packet-type :spawnposition) (read-packet-spawnposition conn)
             :else (str "UNKNOWN PACKET TYPE: " packet-id)
             ))
         (println "\n\n\n")))