0d6765e

Bowmap · bowmap.git · Tickets

Branches > main > 0d6765e > files

Send registry to client

Grahp, 2026-10-03

Commit: 0d6765e7fb01dccbb8da3813f81e241b87ab65dc
Parent: 81fab7e

7 changed files:

src/net/bowmap/server/game/handle.clj modified (view file)

@@ -47,3 +47,10 @@ (defmethod handle-packet ::serverbound/login-acknowledged [_ _]   [{::packet/id ::clientbound/known-packs     ::p/known-packs [registry/core-data-pack]}])++(defmethod handle-packet ::serverbound/known-packs [_ {::p/keys! [known-packs]}]+  (if (= [registry/core-data-pack] known-packs)+    (conj registry/registry-packets+          {::packet/id ::clientbound/finish-config})+    (throw (ex-info "Client does not support the core datapack"+                    {:known-packs known-packs}))))

src/net/bowmap/server/protocol/clientbound_packets.clj modified (view file)

@@ -23,21 +23,25 @@    [::cookie-request nil     ::plugin-message nil     ::disconnect nil-    ::finish-config nil+    ::finish-config (map>)     ::keep-alive nil     ::ping nil     ::reset-chat nil-    ::registry-data nil+    ::registry-data (map> ::p/registry-id identifier>+                          ::p/registry-entries (list> ::p/registry-entry-id identifier>+                                                      ::p/registry-data (optional> nbt>)))     ::remove-resource-pack nil     ::add-resource-pack nil     ::post-effects nil     ::store-cookie nil     ::transfer nil     ::feature-flags nil-    ::update-tags nil-    ::known-packs (map> ::p/known-packs (list> ::p/identifier split-identifier>+    ::update-tags (map> ::p/tagged-registries+                        (list> ::p/registry-id identifier>+                               ::p/tags (list> ::p/tag-name identifier>+                                               ::p/tag-entries (list> varint>))))+    ::known-packs (map> ::p/known-packs (list> ::p/registry-id split-identifier>                                                ::p/pack-version string>))-     ::custom-report-details nil     ::server-links nil     ::clear-dialog nil

src/net/bowmap/server/protocol/registry.clj modified (view file)

@@ -1,8 +1,325 @@ (ns net.bowmap.server.protocol.registry+  "The set of registry and tags required by the client.+   The registry is global to the server. Because clients depend on the registry+   as it was sent to them, it is not REPL reloadable without reconfiguration."   (:require-   [net.bowmap.server.protocol.schema :as p]))+   [clojure.set :as set]+   [clojure.spec.alpha :as s]+   [net.bowmap.server.protocol.clientbound-packets :as clientbound]+   [net.bowmap.server.protocol.identifier :as identifier]+   [net.bowmap.server.protocol.packet :as packet]+   [net.bowmap.server.protocol.schema :as p]+   [net.bowmap.server.protocol.schema.bowmap :as bowmap]+   [net.bowmap.server.protocol.schema.minecraft :as mc]+   [net.bowmap.server.protocol.world :as world]))  (def core-data-pack   "The minecraft:core datapack, known by the vanilla client."-  {::p/registry-id :minecraft/core+  {::p/registry-id ::mc/core    ::p/pack-version "26.3"})++(def world-dimension ::bowmap/world)+(def plains-biome ::mc/plains)++(def block-transformers+  #{::mc/shovel ::mc/axe ::mc/hoe})++(def chicken-variants+  #{::mc/warm ::mc/cold ::mc/temperate})++(def vanilla-damage-types+  #{::mc/cactus ::mc/campfire ::mc/cramming ::mc/dragon_breath ::mc/drown ::mc/dry_out ::mc/ender_pearl ::mc/fall ::mc/fly_into_wall+    ::mc/freeze ::mc/generic ::mc/generic_kill ::mc/hot_floor ::mc/in_fire ::mc/in_wall ::mc/lava ::mc/lightning_bolt ::mc/magic+    ::mc/on_fire ::mc/out_of_world ::mc/outside_border ::mc/spear ::mc/stalagmite ::mc/starve ::mc/sweet_berry_bush ::mc/wither})++(def decorated-pot-patterns+  #{::mc/angler ::mc/archer ::mc/arms_up ::mc/blade ::mc/brewer ::mc/burn ::mc/danger ::mc/explorer ::mc/flow ::mc/friend+    ::mc/guster ::mc/heart ::mc/heartbreak ::mc/howl ::mc/miner ::mc/mourner ::mc/plenty ::mc/prize ::mc/scrape ::mc/sheaf+    ::mc/shelter ::mc/skull ::mc/snort})++(def jukebox-sounds+  #{::mc/#11 ::mc/#13 ::mc/#5 ::mc/blocks ::mc/bounce ::mc/cat ::mc/chirp ::mc/creator ::mc/creator_music_box ::mc/far ::mc/lava_chicken+    ::mc/mall ::mc/mellohi ::mc/otherside ::mc/pigstep ::mc/precipice ::mc/relic ::mc/stal ::mc/strad ::mc/tears ::mc/wait ::mc/ward})++(def trim-materials+  #{::mc/amethyst ::mc/copper ::mc/diamond ::mc/emerald ::mc/gold ::mc/iron ::mc/lapis ::mc/netherite ::mc/quartz ::mc/redstone ::mc/resin})++(def instruments+  #{::mc/ponder_goat_horn})++(defn compound-with-keys? [keys]+  (s/and map? #(set/subset? keys %)))++(s/def ::mc/block_transformer (compound-with-keys? block-transformers))+(s/def ::mc/chicken_variant (compound-with-keys? chicken-variants))+(s/def ::mc/damage_type (compound-with-keys? vanilla-damage-types))+(s/def ::mc/decorated_pot_pattern (compound-with-keys? decorated-pot-patterns))+(s/def ::mc/instrument (compound-with-keys? instruments))+(s/def ::mc/jukebox_song (compound-with-keys? jukebox-sounds))+(s/def ::mc/trim_material (compound-with-keys? trim-materials))+(s/def ::mc/worldgen:biome (compound-with-keys? #{plains-biome}))++(s/def ::registry (s/keys :req [::mc/block_transformer+                                ::mc/cat_sound_variant+                                ::mc/cat_variant+                                ::mc/chicken_sound_variant+                                ::mc/chicken_variant+                                ::mc/cow_sound_variant+                                ::mc/cow_variant+                                ::mc/damage_type+                                ::mc/decorated_pot_pattern+                                ::mc/dimension_type+                                ::mc/frog_variant+                                ::mc/instrument+                                ::mc/jukebox_song+                                ::mc/painting_variant+                                ::mc/pig_sound_variant+                                ::mc/pig_variant+                                ::mc/trim_material+                                ::mc/wolf_sound_variant+                                ::mc/wolf_variant+                                ::mc/worldgen:biome+                                ::mc/zombie_nautilus_variant]))++(def null-component {:text "null"})+(def null-asset "null")+(def null-translation "null")+(def null-sound {:sound_id "null"})+(def null-entry-id ::bowmap/null)++(def registry-placeholder-values+  "Map of registry ids to placeholder values that satisfy that registry but+   otherwise contain no useful information.+   Used when the registry is required, but contains no important information+   or configuration for the server."+  {::mc/block_transformer+   nil+

Show all 328 lines

src/net/bowmap/server/protocol/schema.clj modified (view file)

@@ -1,6 +1,13 @@ (ns net.bowmap.server.protocol.schema   (:require    [clojure.spec.alpha :as s]-   [net.bowmap.server.protocol.identifier :refer [identifier?]]))+   [net.bowmap.server.protocol.identifier :refer [identifier?]]+   [net.bowmap.server.protocol.nbt :as nbt]))  (s/def ::identifier identifier?)++(s/def ::registry-id ::identifier)+(s/def ::registry-entries (s/coll-of ::registry-entry :kind sequential?))+(s/def ::registry-entry (s/map-of ::registry-entry-id ::registry-data))+(s/def ::registry-entry-id ::identifier)+(s/def ::registry-data ::nbt/nbt)

src/net/bowmap/server/protocol/schema/bowmap.clj added (view file)

@@ -0,0 +1,2 @@+(ns net.bowmap.server.protocol.schema.bowmap+  "The default 'bowmap' namespace used in protocol identifiers.")

src/net/bowmap/server/protocol/serverbound_packets.clj modified (view file)

@@ -31,7 +31,7 @@     ::keep-alive nil     ::pong nil     ::resource-pack-response nil-    ::known-packs (map< ::p/known-packs (list< ::p/identifier split-identifier<+    ::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]

src/net/bowmap/server/protocol/world.clj added (view file)

@@ -0,0 +1,5 @@+(ns net.bowmap.server.protocol.world)++(def world-height-chunk-sections 24)+(def world-height (* world-height-chunk-sections 16))+(def world-bottom 0)