3b8b43b
Branches > client-handling-rewrite > 3b8b43b > files / src / net / bowmap
Change client stuff in packet handling
Commit: 3b8b43b9241fe58f978cfa5409fab221d9314a10
Parent: e6caa1b
2 changed files:
src/net/bowmap/core.clj view file
@@ -34,8 +34,7 @@ "Handles one framed Minecraft protocol packet bytes." [client packet-buf] (let [pk (sp/decode-packet packet-buf (::state/state client))- {:keys [::state/state response]} (handle/handle-packet pk client)- client (cond-> client state (assoc ::state/state state))]+ {:keys [client response] :or {client client}} (handle/handle-packet pk client)] (doseq [pk response] (s/put! (::stream client) (encode-packet pk (::state/state client)))) client))@@ -45,7 +44,7 @@ ::stream stream}] (d/catch (s/reduce #'handle-packet client (s/transform (packet-framer-xf) stream)) (fn [e]- (prn "Exception in client packets:" e)))))+ (println "Exception in client packets:" e))))) (defn start-server! [] (tcp/start-server #'client-handlersrc/net/bowmap/packet_handling.clj view file
@@ -14,7 +14,7 @@ (prn "Unhandled packet:" pk)) (defmethod handle-packet ::sp/handshaking [pk client]- {::state/state (:intent pk)})+ {:client (assoc client ::state/state (:intent pk))}) (defmethod handle-packet ::sp/status-request [pk client] {:response [{::pk/id ::cp/status-response@@ -36,7 +36,7 @@ :properties []}]}) (defmethod handle-packet ::sp/login-acknowledged [pk client]- {::state/state ::state/config+ {:client (assoc client ::state/state ::state/config) :response [{::pk/id ::cp/known-packs :known-packs [{:namespace "minecraft" :id "core" :version "1.12.11"}]}]}) @@ -45,4 +45,4 @@ {::pk/id ::cp/finish-config})}) (defmethod handle-packet ::sp/ack-finish-config [pk client]- {::state/state ::state/play})+ {:client (assoc client ::state/state ::state/play)})