2cf928c
Branches > main > 2cf928c > files / src / net / bowmap
Return client value when sending packets out
Commit: 2cf928c9c7c607db4e6fca39e439485d1269665d
Parent: 54c3189
2 changed files:
src/net/bowmap/network/client.clj view file
@@ -56,7 +56,8 @@ (defn send-clientbound-packet [client packet] (println "sending packet out: " packet) (write-frame!! (encode-packet! packet (req! client ::state/connection-state))- (Socket/.getOutputStream (req! client ::socket))))+ (Socket/.getOutputStream (req! client ::socket)))+ client) (defn client [socket] (agent {::socket socketsrc/net/bowmap/network/handle.clj view file
@@ -35,15 +35,13 @@ :max 1000} ; Is this a text component? Could make that interface :description {:text "Bowmap!"}- :enforcesSecureChat false}})- client)+ :enforcesSecureChat false}})) (defmethod handler ::serverbound/ping-request [client pk] (client/send-clientbound-packet client {::pk/id ::clientbound/pong-response- :timestamp (:timestamp pk)})- client)+ :timestamp (:timestamp pk)})) (defmethod handler ::serverbound/login-start [client pk] (let [{:keys! [uuid username]} pk]@@ -53,19 +51,16 @@ :profile {:uuid uuid :username username :properties []}- :session-id (random-uuid)}))- client)+ :session-id (random-uuid)}))) (defmethod handler ::serverbound/login-acknowledged [client _]- (let [client (assoc client ::state/connection-state ::state/config)]- (client/send-clientbound-packet- client- {::pk/id ::clientbound/known-packs- ;; TODO also probably good to unbundle this- :known-packs [{:namespace "minecraft"- :id "core"- :version "26.2"}]})- client))+ (client/send-clientbound-packet+ (assoc client ::state/connection-state ::state/config)+ {::pk/id ::clientbound/known-packs+ ;; TODO also probably good to unbundle this+ :known-packs [{:namespace "minecraft"+ :id "core"+ :version "26.2"}]})) (defmethod handler ::serverbound/known-packs [client _] (doseq [pk (registry/registry-packets)]@@ -97,8 +92,7 @@ {:tag-name "minecraft:pattern_item/skull" :entries []}]}]}) - (client/send-clientbound-packet client {::pk/id ::clientbound/finish-config})- client)+ (client/send-clientbound-packet client {::pk/id ::clientbound/finish-config})) (defn- build-chunk-packets [] (let [pk {::pk/id ::clientbound/chunk-data-and-update-light@@ -169,8 +163,7 @@ :velocity-z 0 :yaw 0 :pitch 0- :flags #{}})- client))+ :flags #{}}))) ; TODO keepalive