b909d47
Branches > facts > b909d47 > files / src / net / bowmap / network / packets
Update packet writers
Commit: b909d477fbcdb1139a345412ede686dd131cbfbb
Parent: ef8193c
1 changed file:
src/net/bowmap/network/packets/writers.clj view file
@@ -43,13 +43,6 @@ (ByteBuf/.writeLong (UUID/.getMostSignificantBits uuid)) (ByteBuf/.writeLong (UUID/.getLeastSignificantBits uuid)))) -; TODO This is where you could check for optionality I think. If the fields aren't [:optional ...]-; TODO Inline-(defn ^:private write-table! [buf table m]- (reduce (fn [acc {::t/keys! [field codec]}]- (codec acc (get m field)))- buf table))- (defn boolean-> [buf x] (if x (ByteBuf/.writeByte buf 1)@@ -66,8 +59,9 @@ (assert (s/valid? ::t/table t)) (let [table (s/conform ::t/table t)] (fn [buf m]- (write-table! buf table m))))-+ (reduce (fn [acc {::t/keys! [field codec]}]+ (codec acc (get m field)))+ buf table)))) (defn coerce "If writer is an actual writer, returns it. If writer is a vector, turnes it into a table writer."@@ -76,7 +70,6 @@ (table-> writer) writer)) -; Only coerces these for now idk (defn array-> [writer] (let [writer (coerce writer)] (fn [buf xs]@@ -239,10 +232,10 @@ (writer buf x)))) (def game-profile-> (table-> [:uuid uuid->- :username string->- :properties (list-> [:name string->- :value string->- :signature (optional-> string->)])]))+ :username string->+ :properties (list-> [:name string->+ :value string->+ :signature (optional-> string->)])])) ; Chunks