3bc0a56

Branches > namespace-reorganization > 3bc0a56 > files / README.md

Fix packet specs

Grahp, 2026-07-08

Commit: 3bc0a562da0f37c8c476f1b3e5d55fb80c6062b2
Parent: d310032

4 changed files:

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

@@ -7,6 +7,11 @@   "The id of a message. See the serverbound and clientbound packet definitions for the names."   qualified-keyword?) +(S/def ::numeric-id+  "Protocol id of a packet, i.e. 0x00, 0x80, etc.+   Numeric ids are NOT unique across connection states! See the wiki"+  pos-int?)+ (S/def ::message   "Represents a logical message map (object) from client to/from server.    'Packet' is used to refer to a serialized message"

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

@@ -29,7 +29,7 @@  (s/fdef build-packet-ids         :args (s/cat :registry (s/map-of ::state/connection-state (s/coll-of ::msg/id :type vector?)))-        :ret (s/map-of (s/schema [::state/connection-state ::msg/id]) ::pk/id))+        :ret (s/map-of (s/schema [::state/connection-state ::msg/id]) ::msg/numeric-id))  (defn build-packets   "Builds a map of message ids to message writers."

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

@@ -35,7 +35,7 @@   (build [[state packet-ids] registry           [i id] (map-indexed vector packet-ids)]     [{::state/connection-state state-      ::pk/id i}+      ::msg/numeric-id i}      id]))  ; TODO document why ids are enumerated like this?

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

@@ -1,14 +1,11 @@ (ns net.bowmap.network.packet   (:require-   [clojure.alpha.spec :as s]-   [dev.grahp.spec :as S]))+   [dev.grahp.spec :as S]) +  (:import+   [io.netty.buffer ByteBuf]))  ; The serialized form of a message, called a packet by everyone else :p ; See https://minecraft.wiki/w/Java_Edition_protocol/Packets -(S/def ::id-  "Protocol id of a packet, i.e. 0x00, 0x80, etc.-   Numeric ids are NOT unique across connection states! See the wiki"-  pos-int?)--(S/def ::packet (s/schema [::id]))+; TODO rename to a frame, packet is still an overloaded term+(S/def ::packet #(instance? ByteBuf %))