a52d65f

Branches > client-handling-rewrite > a52d65f > files / LICENSE

Allow vectors in enum readers and writers

Grahp, 2026-06-27

Commit: a52d65f23aa10062164f27a8cceb0e92ea3439ef
Parent: 9fe9231

3 changed files:

src/net/bowmap/network/message/server.clj modified (view file)

@@ -158,31 +158,16 @@                             :z ->double                             :flags ->byte]      ::set-player-movement-flags [:flags (->bit-mask ->byte [:on-ground :pushing-against-wall])]-     ::player-action [:status (->enum ->varint {0 :started-digging-                                                1 :canceled-digging-                                                2 :finished-digging-                                                3 :drop-item-stack-                                                4 :drop-item-                                                5 :update-item-state-                                                6 :swap-item-in-hand})+     ::player-action [:status (->enum ->varint [:started-digging :canceled-digging :finished-digging+                                                :drop-item-stack :drop-item :update-item-state :swap-item-in-hand])                       ; TODO aren't positions and locations different things?                       :location ->position                       ; TODO block face might be something logical-                      :face (->enum ->byte {0 :bottom-                                            1 :top-                                            2 :north-                                            3 :south-                                            4 :west-                                            5 :east})+                      :face (->enum ->byte [:bottom :top :north :south :west :east])                       :sequence ->varint]      ::player-command [:entity-id ->varint-                       :action-id (->enum ->varint {0 :leave-bed-                                                    1 :start-sprinting-                                                    2 :stop-sprinting-                                                    3 :start-jumping-with-horse-                                                    4 :stop-jumping-with-horse-                                                    5 :open-vehicle-inventory-                                                    6 :start-flying-with-elytra})+                       :action-id (->enum ->varint [:leave-bed :start-sprinting :stop-sprinting :start-jumping-with-horse+                                                    :stop-jumping-with-horse :open-vehicle-inventory :start-flying-with-elytra])                        :jump-boost ->varint]      ::player-abilities [:flags (->bit-mask ->byte {1 :flying?})] ; TODO is this right?      ::set-player-position-and-rotation [:x ->double

src/net/bowmap/network/packet/read.clj modified (view file)

@@ -68,8 +68,9 @@ (def ->identifer ->string)  (defn ->enum [reader m]-  (fn [buf]-    (m (reader buf))))+  (let [m (t/mapize-vector-or-something m)]+    (fn [buf]+      (m (reader buf)))))  ; Table is a keyword? (defn ->table [table-fields]

src/net/bowmap/network/packet/write.clj modified (view file)

@@ -217,7 +217,7 @@   "Writes an enum with writer 't', and a map 'm', which maps encoded values to values, so it is 'backwards'.    For instance, the map {1 :foo} will write :foo as 1."   [writer m]-  (let [m (set/map-invert m)]+  (let [m (set/map-invert (t/mapize-vector-or-something m))]     (fn [buf x]       (writer buf (m x)))))