28161d2

Branches > refactor/use-spec-1 > 28161d2 > files / src / net / bowmap

Slice/frame packets and ignore some I don't care about :p

Grahp, 2026-02-28

Commit: 28161d23a3dbd192b4b49d328b1aac58694a8949
Parent: 05dd723

1 changed file:

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

@@ -63,7 +63,11 @@      ::ping-request [:timestamp :long]      ::login-start [:username :string                     :uuid :uuid]-     ::login-acknowledged []}))+     ::login-acknowledged []+     ;; This packet has more fields I just don't care about them :p+     ::server-plugin-message []+     ;; This packet also has a bunch of fields that I probably do care about!+     ::client-information []}))  (defn decode-packet!   "Decodes and returns one packet from ByteBuf 'buf', which should contain at least one readable packet.@@ -74,12 +78,11 @@     3. The contents of 'buf' are not a valid packet"   [buf state]   {:pre [(read/can-read-packet? buf)]}-  ;; The length field is currently unused-  ;; login 0x04 (::net.bowmap.packet.client/login-plugin-request) requires the length-  (let [_unused-length (read/read-varint! buf)-        numeric-id (read/read-varint! buf)+  (let [length (read/read-varint! buf)+        packet (ByteBuf/.readSlice buf length)+        numeric-id (read/read-varint! packet)         packet-id (packet-ids {::state/state state ::pk/numeric-id numeric-id})         dedec (packets packet-id)]     (if dedec-      (dedec buf)+      (dedec packet)       (raise "Failed to decode packet, no such packet with that id." {:id numeric-id :state state :packet-id packet-id}))))