1fcddae

Branches > main > 1fcddae > files

Add set entity metadata packet

Grahp, 2026-08-25

Commit: 1fcddaec8afd1055efbf071e78ef747bf6a32f50
Parent: 924dc67

2 changed files:

src/net/bowmap/protocol/packet/clientbound.clj modified (view file)

@@ -5,9 +5,10 @@    [net.bowmap.transport.phase :as phase]    [net.bowmap.transport.writers :as write     :refer [angle-> bit-mask-> boolean-> byte-> chunk-data->-            context-optional-> double-> enum-> float-> game-profile->-            identifier-> int-> json-> light-data-> list-> location-> long->-            lpvec3-> nbt-> optional-> or-> string-> ubyte-> uuid-> varint->]]))+            context-optional-> double-> entity-metadata-> enum-> float->+            game-profile-> identifier-> int-> json-> light-data-> list->+            location-> long-> lpvec3-> nbt-> optional-> or-> string-> ubyte->+            uuid-> varint->]]))  (def packets   {::status-response [:response "Response to serverbound ::status-request" json->]@@ -72,6 +73,8 @@                    :yaw angle->                    :head-yaw angle->                    :data varint->]+   ::set-entity-metadata [:entity-id varint->+                          :metadata entity-metadata->]    ::chunk-data-and-update-light [:chunk-x int->                                   :chunk-z int->                                   :chunk-data chunk-data->

src/net/bowmap/transport/writers.clj modified (view file)

@@ -312,3 +312,13 @@         (when needs-continuation?           (varint-> buf (bit-shift-right scale-factor 2)))         buf))))++; Welcome, to the most bizzare part of the protocol!+(defn entity-metadata-> [buf {:keys [block-state] :select metadata :as m}]+  ; check for fire, sneak, invisible, etc. flags and bundle into one+  (when (not= metadata m)+    (println "Additional fields:" (apply dissoc m (keys metadata))))+  (when block-state+    (varint-> buf 14)+    (varint-> buf block-state))+  (ubyte-> buf 0xFF))