   (-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 -----------------------------------------------------------------

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

    )
  (flushc conn))

        :explosion                 (read-packet-explosion conn)
        :soundeffect               (read-packet-soundeffect conn)
        :newinvalidstate           (read-packet-newinvalidstate conn)
        :thunderbolt               (read-packet-thunderbolt conn)
        :openwindow                (read-packet-openwindow conn)

        :else (str "UNKNOWN PACKET TYPE: " packet-id)
        ))
