b368129

Bowmap · bowmap.git · Tickets

Branches > main > b368129 > files

Use nil to denote the lack of a clientbound packet writer

Grahp, 2026-09-13

Commit: b3681292c72bcbea2b9d3073112c8e9dc2579b71
Parent: 5e1b63e

2 changed files:

src/net/bowmap/server/protocol/clientbound_packets.clj modified (view file)

@@ -4,180 +4,178 @@    [net.bowmap.server.protocol.schema :as p]    [net.bowmap.server.protocol.writers :refer :all])) -(defn ? [_] (throw (Exception. "Error while encoding packet: no packet definition for that packet id")))- (def clientbound-packets   "Map of connection phases to pairs of [clientbound-packet-id writer]"   {::phase/status    [::status-response status-response->     ::pong-response [::p/timestamp long->]]    ::phase/login-   [::disconnect ?-    ::encryption-request ?-    ::login-success ?-    ::set-compression ?-    ::login-plugin-request ?-    ::cookie-request ?]+   [::disconnect nil+    ::encryption-request nil+    ::login-success nil+    ::set-compression nil+    ::login-plugin-request nil+    ::cookie-request nil]    ::phase/config-   [::cookie-request ?-    ::plugin-message ?-    ::disconnect ?-    ::finish-config ?-    ::keep-alive ?-    ::ping ?-    ::reset-chat ?-    ::registry-data ?-    ::remove-resource-pack ?-    ::add-resource-pack ?-    ::store-cookie ?-    ::transfer ?-    ::feature-flags ?-    ::update-tags ?-    ::known-packs ?-    ::custom-report-details ?-    ::server-links ?-    ::clear-dialog ?-    ::show-dialog ?-    ::code-of-conduct ?]+   [::cookie-request nil+    ::plugin-message nil+    ::disconnect nil+    ::finish-config nil+    ::keep-alive nil+    ::ping nil+    ::reset-chat nil+    ::registry-data nil+    ::remove-resource-pack nil+    ::add-resource-pack nil+    ::store-cookie nil+    ::transfer nil+    ::feature-flags nil+    ::update-tags nil+    ::known-packs nil+    ::custom-report-details nil+    ::server-links nil+    ::clear-dialog nil+    ::show-dialog nil+    ::code-of-conduct nil]    ::phase/play-   [::bundle-delimiter ?-    ::spawn-entity ?-    ::entity-animation ?-    ::award-statistics ?-    ::acknowledge-block-change ?-    ::set-block-destroy-stage ?-    ::block-entity-data ?-    ::block-action ?-    ::block-update ?-    ::boss-bar ?-    ::change-difficulty ?-    ::chunk-batch-finished ?-    ::chunk-batch-start ?-    ::chunk-biomes ?-    ::clear-titles ?-    ::command-suggestions-response ?-    ::commands ?-    ::close-container ?-    ::set-container-content ?-    ::set-container-property ?-    ::set-container-slot ?-    ::cookie-request ?-    ::set-cooldown ?-    ::chat-suggestions ?-    ::plugin-message ?-    ::damage-event ?-    ::debug-block-value ?-    ::debug-chunk-value ?-    ::debug-entity-value ?-    ::debug-event ?-    ::debug-sample ?-    ::delete-message ?-    ::disconnect ?-    ::disguised-chat-message ?

Show all 348 lines

src/net/bowmap/server/protocol/codec.clj modified (view file)

@@ -24,7 +24,9 @@   [{::phase/keys! [phase]} {::packet/keys! [id] :as packet}]   (let [schemas (clientbound-packets phase)         [numeric-id schema] (find-indexed id schemas)-        payload-writer (writers/to-writer schema)]+        payload-writer (if (some? schema)+                         (writers/to-writer schema)+                         (throw (ex-info "No such packet with that id!" {:phase phase :numeric-id numeric-id})))]     (length-prefixed       (-> (frame)           (writers/varint-> numeric-id)