registry.clj
Branches > main > 8adfb52 > files / src / net / bowmap / protocol / packet / registry.clj
(ns net.bowmap.protocol.packet.registry
(:require
[net.bowmap.protocol.packet :as pk]
[net.bowmap.protocol.packet.clientbound :as clientbound]
[net.bowmap.protocol.registry :as reg]))
; Not in love with this...
(defn registry-packets []
(for [[registry-id entries] reg/registries]
{::pk/id ::clientbound/registry-data
::reg/id registry-id
::reg/entries (for [[value] (sort-by val (req! reg/registry-values->ids registry-id))]
{::reg/entry-id value
::reg/entry-data (entries value)})}))
(defn tag-packets []
(for [[registry tags] reg/tags]
{::pk/id ::clientbound/update-tags
:tagged-registries [{:registry registry
:tags (for [tag-name tags]
{:tag-name tag-name
; Tags currently don't support values other than empty
:entries []})}]}))
(defn registry-and-tag-packets []
(into (vec (registry-packets))
(tag-packets)))