b1b0aa7
Branches > main > b1b0aa7 > files
Reframe references to the protocol as being about packets and encoding
Commit: b1b0aa771dda47966d48d723cee585d76a81b568
Parent: 66ff639
6 changed files:
Glossary.md view file
@@ -2,10 +2,6 @@ The Minecraft client on the other end of a connection. -## Protocol--The format used between the client and the server to communicate. The protocol is made of a set of packets.- ## Packet A map representing a message that can be sent to the client (clientbound) or to the server (serverbound).src/net/bowmap/server/packet/frame.clj view file
@@ -5,7 +5,7 @@ [io.netty.buffer ByteBuf ByteBufUtil Unpooled])) (defprotocol Frame- "A immutable sequence of bytes representing one framed, serialized Minecraft protocol packet.+ "A immutable sequence of bytes representing one framed, serialized packet. Frames contain the packet's numeric id and payload, but are not length-prefixed. See https://minecraft.wiki/w/Java_Edition_protocol/Packets for the packet format." (write! [frame f] "Calls 'f' with the array and length of the frame."))src/net/bowmap/server/packet/identifier.clj view file
@@ -7,7 +7,7 @@ (def name-regex #"^#?[a-z0-9.\-_:]+$") (defn identifier?- "Returns whether 'x' is a valid protocol identifier - a namspace qualified keyword.+ "Returns whether 'x' is a valid identifier - a namspace qualified keyword. Colons in the name of an identifier may used to separate directories. If the identifier's name starts with a number, it must be prefixed with a '#'. Identifiers in the 'minecraft' namespace should use the fully qualified minecraft@@ -18,21 +18,21 @@ (re-matches name-regex (name x)))) (defn encode-namespace- "Encodes an identifier namespace into a valid protocol namespace."+ "Encodes an identifier namespace into a string namespace." [identifier] (if (= (namespace identifier) mc/minecraft-namespace) "minecraft" (namespace identifier))) (defn encode-name- "Encodes an identifier name into a valid protocol name."+ "Encodes an identifier name into a string name." [identifier] (-> (name identifier) (str/replace-first #"^#" "") (str/replace ":" "/"))) (defn encode-identifier- "Encodes an identifier as a protocol identifier string."+ "Encodes an identifier as a string." [identifier] (str (encode-namespace identifier) ":" (encode-name identifier))) @@ -61,7 +61,7 @@ {:namespace namespace :name name}))))) (defn tag- "Returns the protocol tag of an identifier, which is the encoded identifier+ "Returns the string tag of an identifier, which is the encoded identifier preceded by a '#'." [identifier] (apply str "#" (encode-identifier identifier)))src/net/bowmap/server/packet/schema/bowmap.clj view file
@@ -1,2 +1,2 @@ (ns net.bowmap.server.packet.schema.bowmap- "The default 'bowmap' namespace used in protocol identifiers.")+ "The default 'bowmap' namespace used in encoded identifiers.")src/net/bowmap/server/packet/schema/minecraft.clj view file
@@ -1,4 +1,4 @@ (ns net.bowmap.server.packet.schema.minecraft- "The default 'minecraft' namespace used in protocol identifiers.")+ "The default 'minecraft' namespace used in encoded identifiers.") (def minecraft-namespace (str (ns-name *ns*)))src/net/bowmap/server/packet/writers.clj view file
@@ -232,7 +232,7 @@ (bit-and y 0xFFF)))) (defn nbt-string>- "Writes an NBT string to buf. May take a string, keyword, or protocol identifier.+ "Writes an NBT string to buf. May take a string, keyword, or packet identifier. Strings are prefixed by an unsigned short length, followed by up to 65,535 modified UTF-8 bytes." [buf s]@@ -311,7 +311,7 @@ (defn nbt> "Writes an NBT value to buf. Throws if the value is not valid NBT.- NBT in the protocol is prefixed with the byte 0x0A, followed by the type's payload.+ Encoded NBT is prefixed with the byte 0x0A, followed by the type's payload. See https://minecraft.wiki/w/Minecraft_Wiki:Projects/wiki.vg_merge/NBT#Network_NBT_(Java_Edition)" [buf x] (-> buf