   (-write-byte conn (:newinvalidstate packet-ids))
 
   (-write-byte conn reason))
+
+(defn write-packet-openwindow [conn {windowid :windowid inventorytype :inventorytype windowtitle :windowtitle numberofslots :numberofslots}]
+  (-write-byte conn (:openwindow packet-ids))
+
+  (-write-byte conn windowid)
+  (-write-byte conn inventorytype)
+  (-write-string8 conn windowtitle)
+  (-write-byte conn numberofslots)
+)
 
 
 ; Writing Wrappers -----------------------------------------------------------------

  (doto (:out @conn)
    (.writeFloat (int i))))

(defn -write-string16 [conn s]
  (-write-short conn (count s))
  (println (str "-> STRING: " s))

    :explosion            (write-packet-explosion conn payload)
    :soundeffect          (write-packet-soundeffect conn payload)
    :newinvalidstate      (write-packet-newinvalidstate conn payload)
    :openwindow           (write-packet-openwindow conn payload)

    )
  (flushc conn))
