61487ea
Branches > namespace-reorganization > 61487ea > files / src / net / bowmap / packet
Add registry and chunks
Commit: 61487eab3f02a758191a4cc773caa3d7b5f3dc0f
Parent: b1323ba
2 changed files:
src/net/bowmap/packet/chunk.clj view file
@@ -0,0 +1,15 @@+(ns net.bowmap.packet.chunk+ (:require [clojure.alpha.spec :as s]))++(s/def ::coordinate (s/schema [::x ::y ::z]))+(s/def ::data (s/map-of ::coordinate ::chunk-section))+(s/def ::block-bpe #{0 4 5 6 7 8 15})+(s/def ::biome-bpe #{0 1 2 3 7})+(s/def ::block-states vector?)+(s/def ::biomes vector?)+(s/def ::chunk-section (s/schema [::block-bpe ::biome-bpe]))++(s/def ::world (s/map-of ::coordinate ::chunk-section))++(def world-height-chunk-sections 24)+(def world-height (* world-height-chunk-sections 16))src/net/bowmap/packet/registry.clj view file
@@ -0,0 +1,94 @@+(ns net.bowmap.packet.registry+ (:require+ [net.bowmap.packet.chunk :as chunk]+ [net.bowmap.packet :as pk]+ [net.bowmap.packet.client :as cp]))++;; Some way to keep track of order of these things and make that clear...+;; Probably a map of id -> order?+;; So maybe this needs to be a macro or something idk+(let [damage-types ["cactus" "campfire" "cramming" "dragon_breath" "drown" "dry_out" "ender_pearl" "fall" "out_of_world"+ "fly_into_wall" "freeze" "generic" "generic_kill" "hot_floor" "in_fire" "in_wall" "lava"+ "lightning_bolt" "magic" "on_fire" "outside_border" "stalagmite" "starve" "sweet_berry_bush" "wither"]]++ (def registries ["worldgen/biome" {"plains" {:has_precipitation false+ :temperature 1.0+ :temperature_modifier "none"+ :downfall 1.0+ :effects {:fog_color 880000+ :water_color 880000 ;8364543+ :water_fog_color 880000+ :sky_color 880000}}}++ "damage_type" (zipmap damage-types (repeat {:exhaustion 0x0+ :message_id "onFire"+ :scaling "never"}))++ "dimension_type" {"world" {:has_skylight 1+ :has_ceiling 0+ :ultrawarm 0+ :natural 1+ :coordinate_scale 1.0+ :bed_works 1+ :respawn_anchor_works 1+ :min_y 0+ :height chunk/world-height+ :logical_height chunk/world-height+ :infiniburn "#"+ :effects "minecraft:overworld"+ :ambient_light 0.0+ :piglin_safe 0+ :has_raids 0+ :monster_spawn_light_level 8+ :monster_spawn_block_light_limit 8}}++ "cat_variant" {"cats" {:asset_id "cat"+ :spawn_condition []}}++ "chicken_variant" {"chicken" {:asset_id "chicken"+ :model "normal"+ :spawn_condition []}}++ "cow_variant" {"cow" {:asset_id "cow"+ :model "normal"+ :spawn_condition []}}++ "frog_variant" {"frog" {:asset_id "frog"+ :spawn_condition []}}++ "pig_variant" {"pig" {:asset_id "pig"+ :model "normal"+ :spawn_condition []}}++ "wolf_variant" {"wolf" {:asset_id "wolf"+ :assets {:angry "minecraft:angry"+ :tame "minecraft:tame"+ :wild "minecraft:wild"}+ :spawn_condition []}}++ "painting_variant" {"painting" {:asset_id "painting"+ :height 1+ :width 1+ :title "Fred"+ :author "Lucy"}}++ "wolf_sound_variant" {"wolf_sound" {:ambient_sound "minecraft:entity.wolf.ambient"+ :death_sound "minecraft:entity.wolf.ambient"+ :growl_sound "minecraft:entity.wolf.ambient"+ :hurt_sound "minecraft:entity.wolf.ambient"+ :pant_sound "minecraft:entity.wolf.ambient"+ :whine_sound "minecraft:entity.wolf.ambient"}}]))++;; Make a map of ids -> order+#_(defn registry-id+ "Function to get the ordered numerical id from a given registry id"+ [id])++;; TODO this shouldn't be here :p+(def registry-packets+ (for [[id m] (partition 2 registries)]+ {::pk/id ::cp/registry-data+ :registry-id id+ :entries (for [[entry-id data] m]+ {:id entry-id+ :data data})}))