API reference / @jsprismarine/protocol / Skin
Class: Skin
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:250
The client's SerializedSkin data: image, cape, geometry, animations, and persona metadata. JWT fields are decoded here and the protocol layout writes the resulting values to the player list. Geometry and animation documents remain opaque strings for the client to interpret.
Constructors
Constructor
new Skin():
Skin
Returns
Skin
Properties
fullId
fullId:
string
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:274
Full skin ID, computed because not sent on JWT.
isTrusted
isTrusted:
boolean=true
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:275
Methods
getAnimationData()
getAnimationData():
string
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:563
Returns
string
getAnimations()
getAnimations():
Set<SkinAnimation>
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:559
Returns
Set<SkinAnimation>
getArmSize()
getArmSize():
string
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:583
Returns
string
getCape()
getCape():
SkinCape
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:615
Returns
getColor()
getColor():
string
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:579
Returns
string
getFullId()
getFullId():
string
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:534
Returns
string
getGeometry()
getGeometry():
string
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:591
Returns
string
getGeometryDataEngineVersion()
getGeometryDataEngineVersion():
string
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:596
The GeometryDataMinEngineVersion string; 0.0.0 for a skin built from login data.
Returns
string
getId()
getId():
string
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:530
Returns
string
getImage()
getImage():
SkinImage
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:555
Returns
getPersonaData()
getPersonaData():
SkinPersona
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:587
Returns
getPlayFabId()
getPlayFabId():
string
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:538
Returns
string
getProfileHash()
getProfileHash():
string
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:611
The wire's ProfileHash string; empty for a skin built from login data.
Returns
string
getResourcePatch()
getResourcePatch():
string
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:551
Returns
string
isCapeOnClassicSkin()
isCapeOnClassicSkin():
boolean
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:575
Returns
boolean
isPersona()
isPersona():
boolean
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:567
Returns
boolean
isPremium()
isPremium():
boolean
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:571
Returns
boolean
isPrimaryUser()
isPrimaryUser():
boolean
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:601
The wire's IsPrimaryUser flag. False for a skin built from login data.
Returns
boolean
networkSerialize()
networkSerialize(
stream,layout?):void
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:389
Writes the skin as protocol 2193 carries it.
The layout had drifted years out of date - it was still the 748-era shape, which is exactly the sort of thing that only shows up against a real client, because this server's own client decoded it with the same stale reader. Checked field for field against gophertunnel's protocol/skin.go and against the bytes protocol 2193's pinned Bedrock Dedicated Server puts on the wire. What was wrong:
- The animation, persona-piece and tint counts were fixed 32-bit little-endian ints; they are unsigned varints, like every other list.
- The arm size was a string; it is a single byte (
slim0,wide1). - The skin color was a string; it is four bytes, B, G, R, A.
- The tail was missing two fields the client reads:
trusted, sent as the string"true"/"false", and a profile hash string. Without them the entry after this one in the player list is read from the wrong place, and the client drops the join.
The persona branch was missed by that pass and found the same way, by a 1.26.51 client with a character-creator skin dropping the join with InitialConnection-90 (#2582). A piece's type and pack id went out as strings; the type is a uint32 and the pack id a 16-byte UUID. A tint's colors went out as a counted list of strings; they are exactly four colors of four bytes each, with no count, under the piece type's lower-case member name (facialhair, not the client data's facial_hair; see PIECE_TYPE_NAMES_2193).
Parameters
stream
layout?
SkinWireLayout = SKIN_WIRE_2193
Returns
void
overridesAppearance()
overridesAppearance():
boolean
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:606
The wire's OverridesPlayerAppearance flag. True for a skin built from login data.
Returns
boolean
setPlayFabId()
setPlayFabId(
playFabId):void
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:547
Puts the PlayFab id back on a skin read under the 2225 layout, where it arrived on the enclosing player list entry rather than inside the skin.
Parameters
playFabId
string
the id the entry carried.
Returns
void
fromJWT()
staticfromJWT(jwt):Skin
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:283
Loads a skin from a JSON file containing skin data using minecraft bedrock login fields.
(loads the skin persona)
Parameters
jwt
Returns
Skin
networkDeserialize()
staticnetworkDeserialize(stream,layout?):Skin
Defined in: protocol/src/bedrock/wire/structures/skin/Skin.ts:472
Reads a skin as protocol 2193 carries it, field for field the inverse of networkSerialize.
Wire values are stored the way the client data would have given them, so a skin read here and written again produces the same bytes: the arm size byte becomes slim or wide, colors become #aarrggbb, and a piece's pack id becomes its UUID string. Persona piece types are kept by their wire name (body, hands), which the writer accepts as it is. A piece type above the known range reads as unknown. The persona pieces and tints arrive before the IsPersona flag, so they are read for every skin and kept only when the flag is set. TrustedSkinFlag is compared case-insensitively: the docs spell it "True", gophertunnel writes true.
Parameters
stream
layout?
SkinWireLayout = SKIN_WIRE_2193
Returns
Skin