serverbound.clj
Branches > main > 6a591c6 > files / src / net / bowmap / server / packet / serverbound.clj
(ns net.bowmap.server.packet.serverbound
(:require
[net.bowmap.server.packet.phase :as phase]
[net.bowmap.server.packet.readers :refer :all]
[net.bowmap.server.packet.schema :as p]))
(def serverbound-packets
"Map of connection phases to pairs of serverbound packet IDs and readers.
The ordering of packet IDs in the vectors determines their numeric ID."
{::phase/handshaking
[::handshaking (map< ::p/version-id varint<
:address string<
:port short<
::phase/phase (enum< varint< {1 ::phase/status 2 ::phase/login 3 ::phase/transfer}))]
::phase/status
[::status-request (map<)
::ping-request (map< ::p/timestamp long<)]
::phase/login
[::login-start (map< ::p/username string<
::p/uuid uuid<)
::encryption-response nil
::login-plugin-response nil
::login-acknowledged (map<)
::cookie-response nil]
::phase/config
[::client-information nil
::cookie-response nil
::plugin-message nil
::finish-config (map<)
::keep-alive nil
::pong nil
::resource-pack-response nil
::known-packs (map< ::p/known-packs (list< ::p/registry-id split-identifier<
::p/pack-version string<))
::custom-click-action nil
::accept-code-of-conduct nil]
::phase/play
[::confirm-teleportation nil
::attack nil
::query-block-entity-tag nil
::bundle-item-selected nil
::change-difficulty nil
::change-game-mode nil
::acknowledge-message nil
::chat-command nil
::signed-chat-command nil
::chat-message nil
::player-session nil
::chunk-batch-received nil
::client-status nil
::client-tick-end nil
::client-information nil
::command-suggestions-request nil
::acknowledge-configuration nil
::click-container-button nil
::click-container nil
::close-container nil
::change-container-slot-state nil
::cookie-response nil
::plugin-message nil
::debug-subscription-request nil
::edit-book nil
::query-entity-tag nil
::interact nil
::jigsaw-generate nil
::keep-alive nil
::lock-difficulty nil
::set-player-position nil
::set-player-position-and-rotation nil
::set-player-rotation nil
::set-player-movement-flags nil
::move-vehicle nil
::paddle-boat nil
::pick-item-from-block nil
::pick-item-from-entity nil
::ping-request nil
::place-recipe nil
::player-abilities nil
::player-action nil
::player-command nil
::player-input nil
::player-loaded nil
::pong nil
::punch nil
::change-recipe-book-settings nil
::set-seen-recipe nil
::rename-item nil
::resource-pack-response nil
::seen-advancements nil
::select-trade nil
::set-beacon-effect nil
::select-hotbar-slot nil
::program-command-block nil
::program-command-block-minecart nil
::set-creative-mode-slot nil
::set-game-rules nil
::program-jigsaw-block nil
::program-structure-block nil
::set-test-block nil
::update-sign nil
::spectator-action nil
::teleport-to-entity nil
::test-instance-block-action nil
::use-item-on nil
::use-item nil
::custom-click-action nil]})
(def phase->numeric-id->id (update-vals serverbound-packets #(zipmap (range) (take-nth 2 %))))
(def phase->id->reader (update-vals serverbound-packets #(some-vals (apply hash-map %))))
(def ids (set (mapcat #(take-nth 2 %) (vals serverbound-packets))))