# HG changeset patch # User Steve Losh # Date 1308872285 14400 # Node ID a2bc9cda9da98efa5a6a8c3c422e6896d028873f # Parent 6b4574bb3ec67841ed8b28d5444a508f8c2ab2fa Moar. diff -r 6b4574bb3ec6 -r a2bc9cda9da9 src/clojurecraft/core.clj --- a/src/clojurecraft/core.clj Thu Jun 23 19:35:54 2011 -0400 +++ b/src/clojurecraft/core.clj Thu Jun 23 19:38:05 2011 -0400 @@ -342,8 +342,12 @@ (-write-byte conn windowid) (-write-byte conn inventorytype) (-write-string8 conn windowtitle) - (-write-byte conn numberofslots) -) + (-write-byte conn numberofslots)) + +(defn write-packet-closewindow [conn {windowid :windowid}] + (-write-byte conn (:closewindow packet-ids)) + + (-write-byte conn windowid)) ; Writing Wrappers ----------------------------------------------------------------- @@ -379,6 +383,7 @@ :soundeffect (write-packet-soundeffect conn payload) :newinvalidstate (write-packet-newinvalidstate conn payload) :openwindow (write-packet-openwindow conn payload) + :closewindow (write-packet-closewindow conn payload) ) (flushc conn)) @@ -752,6 +757,10 @@ :windowtitle (-read-string8 conn) :numberofslots (-read-byte conn))) +(defn read-packet-closewindow [conn] + (assoc {} + :windowid (-read-byte conn))) + ; Reading Wrappers ----------------------------------------------------------------- (defn read-packet [conn packet-id] @@ -804,6 +813,7 @@ :newinvalidstate (read-packet-newinvalidstate conn) :thunderbolt (read-packet-thunderbolt conn) :openwindow (read-packet-openwindow conn) + :closewindow (read-packet-closewindow conn) :else (str "UNKNOWN PACKET TYPE: " packet-id) ))