c7e34ca

Branches > namespace-reorganization > c7e34ca > files / src / net / bowmap / network

add gamemode spec

Grahp, 2026-06-04

Commit: c7e34ca1f64a9d9941cdb5f0860695eb282e2ef8
Parent: 46a654f

4 changed files:

src/net/bowmap/message_application.clj modified (view file)

@@ -6,9 +6,10 @@    [net.bowmap.network.client :as client]    [net.bowmap.network.message :as msg]    [net.bowmap.network.message.client :as cl]-   [net.bowmap.network.message.server :as srv]    [net.bowmap.network.message.registry :as registry]-   [net.bowmap.network.state :as state]))+   [net.bowmap.network.message.server :as srv]+   [net.bowmap.network.state :as state]+   [net.bowmap.server.gamemode :as gamemode]))  (S/def ::messages (s/coll-of ::msg/message :type vector?)) (S/def ::process-id qualified-keyword?)@@ -120,8 +121,7 @@          :dimension-type-id 0          :dimension-name "world"          :hashed-seed 203894-         :gamemode :creative-         :previous-gamemode :unknown+         :gamemode ::gamemode/creative          :debug-world? false          :superflat-world? true          :has-death-location? false

src/net/bowmap/network/message/client.clj modified (view file)

@@ -12,7 +12,8 @@             light-data-> list-> long-> nbt-> optional-> or-> position->             string-> table-> ubyte-> uuid-> varint->]]    [net.bowmap.network.registry :as reg]-   [net.bowmap.network.state :as state])+   [net.bowmap.network.state :as state]+   [net.bowmap.server.gamemode :as gamemode])   (:import    [io.netty.buffer Unpooled])) @@ -247,9 +248,9 @@               :dimension-name identifier->               :hashed-seed long->               ;; TODO :net.bowmap.gamemode ig?-              :gamemode (enum-> ubyte-> {0 :survival 1 :creative 2 :adventure 3 :spectator})+              :gamemode (enum-> ubyte-> {0 ::gamemode/survival 1 ::gamemode/creative 2 ::gamemode/adventure 3 ::gamemode/spectator})               ;; Wonder if this should return a map instead where unknown is not present-              :previous-gamemode (enum-> byte-> {-1 :unknown 0 :survival 1 :creative 2 :adventure 3 :spectator})+              :previous-gamemode (enum-> (or-> byte-> -1) {0 ::gamemode/survival 1 ::gamemode/creative 2 ::gamemode/adventure 3 ::gamemode/spectator})               :debug-world? boolean->               :superflat-world? boolean->               :has-death-location? boolean->

src/net/bowmap/network/packet/write.clj modified (view file)

@@ -192,7 +192,6 @@ (defn position-> [pos]   (raise "YOU NEVER ACTUALLY IMPLEMENTED THE POSITION TYPE REMEMBER?")) -; TODO is this right? (defn or-> [writer default]   (fn [buf x]     (let [x (if (nil? x) default x)]

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

@@ -0,0 +1,5 @@+(ns net.bowmap.server.gamemode+  (:require+   [dev.grahp.spec :as S]))++(S/def ::gamemode #{::survival ::creative ::adventure ::spectator})