clientbound_packets.clj
Branches > main > 0123d38 > files / src / net / bowmap / server / protocol / clientbound_packets.clj
(ns net.bowmap.server.protocol.clientbound-packets
(:require
[net.bowmap.server.protocol.phase :as phase]
[net.bowmap.server.protocol.schema :as p]
[net.bowmap.server.protocol.writers :refer :all]))
(def clientbound-packets
"Map of connection phases to pairs of [clientbound-packet-id writer]"
{::phase/status
[::status-response status-response>
::pong-response [::p/timestamp long>]]
::phase/login
[::disconnect nil
::encryption-request nil
::login-success [::p/game-profile game-profile>
::p/session-uuid uuid>]
::set-compression nil
::login-plugin-request nil
::cookie-request nil]
::phase/config
[::cookie-request nil
::plugin-message nil
::disconnect nil
::finish-config nil
::keep-alive nil
::ping nil
::reset-chat nil
::registry-data nil
::remove-resource-pack nil
::add-resource-pack nil
::store-cookie nil
::transfer nil
::feature-flags nil
::update-tags nil
::known-packs nil
::custom-report-details nil
::server-links nil
::clear-dialog nil
::show-dialog nil
::code-of-conduct nil]
::phase/play
[::bundle-delimiter nil
::spawn-entity nil
::entity-animation nil
::award-statistics nil
::acknowledge-block-change nil
::set-block-destroy-stage nil
::block-entity-data nil
::block-action nil
::block-update nil
::boss-bar nil
::change-difficulty nil
::chunk-batch-finished nil
::chunk-batch-start nil
::chunk-biomes nil
::clear-titles nil
::command-suggestions-response nil
::commands nil
::close-container nil
::set-container-content nil
::set-container-property nil
::set-container-slot nil
::cookie-request nil
::set-cooldown nil
::chat-suggestions nil
::plugin-message nil
::damage-event nil
::debug-block-value nil
::debug-chunk-value nil
::debug-entity-value nil
::debug-event nil
::debug-sample nil
::delete-message nil
::disconnect nil
::disguised-chat-message nil
::entity-event nil
::teleport-entity nil
::explosion nil
::unload-chunk nil
::game-event nil
::game-rule-values nil
::game-test-highlight-position nil
::open-horse-screen nil
::hurt-animation nil
::initialize-world-border nil
::keep-alive nil
::chunk-data-and-update-light nil
::world-event nil
::particle nil
::update-light nil
::login nil
::low-disk-space-warning nil
::map-data nil
::merchant-offers nil
::update-entity-position nil
::update-entity-position-and-rotation nil
::move-minecart-along-track nil
::update-entity-rotation nil
::move-vehicle nil
::open-book nil
::open-screen nil
::open-sign-editor nil
::ping nil
::pong-response nil
::place-ghost-recipe nil
::player-abilities nil
::player-chat-message nil
::end-combat nil
::enter-combat nil
::combat-death nil
::player-info-remove nil
::player-info-update nil
::look-at nil
::synchronize-player-position nil
::player-rotation nil
::recipe-book-add nil
::recipe-book-remove nil
::recipe-book-settings nil
::remove-entities nil
::remove-entity-effect nil
::reset-score nil
::remove-resource-pack nil
::add-resource-pack nil
::respawn nil
::set-head-rotation nil
::update-section-blocks nil
::select-advancements-tab nil
::server-data nil
::set-action-bar-text nil
::set-border-center nil
::set-border-lerp-size nil
::set-border-size nil
::set-border-warning-delay nil
::set-border-warning-distance nil
::set-camera nil
::set-center-chunk nil
::set-render-distance nil
::set-cursor-item nil
::set-default-spawn-position nil
::display-objective nil
::set-entity-metadata nil
::link-entities nil
::set-entity-velocity nil
::set-equipment nil
::set-experience nil
::set-health nil
::set-held-item nil
::update-objectives nil
::set-passengers nil
::set-player-inventory-slot nil
::update-teams nil
::update-score nil
::set-simulation-distance nil
::set-subtitle-text nil
::update-time nil
::set-title-text nil
::set-title-animation-times nil
::entity-sound-effect nil
::sound-effect nil
::start-configuration nil
::stop-sound nil
::store-cookie nil
::system-chat-message nil
::set-tab-list-header-and-footer nil
::tag-query-response nil
::pickup-item nil
::synchronize-vehicle-position nil
::test-instance-block-status nil
::set-ticking-state nil
::step-tick nil
::transfer nil
::update-advancements nil
::update-attributes nil
::entity-effect nil
::update-recipes nil
::update-tags nil
::projectile-power nil
::custom-report-details nil
::server-links nil
::waypoint nil
::clear-dialog nil
::show-dialog-play nil]})
(def phase->id->numeric-id (update-vals clientbound-packets #(zipmap (take-nth 2 %) (range))))
(def phase->id->writer (update-vals clientbound-packets #(-> (apply hash-map %)
some-vals
(update-vals ->writer))))
(def ids (set (mapcat #(take-nth 2 %) (vals clientbound-packets))))