Skip to content

Commit 7043bf4

Browse files
authored
fix: adding support for newer skin profile data structure in player heads (#424)
2 parents 9d54c70 + 528d8f5 commit 7043bf4

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

renderer/viewer/three/worldrendererThree.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -767,12 +767,17 @@ export class WorldRendererThree extends WorldRendererCommon {
767767
}
768768

769769
renderHead (position: Vec3, rotation: number, isWall: boolean, blockEntity) {
770-
const textures = blockEntity.SkullOwner?.Properties?.textures[0]
771-
if (!textures) return
770+
let textureData: string
771+
if (blockEntity.SkullOwner) {
772+
textureData = blockEntity.SkullOwner.Properties?.textures?.[0]?.Value
773+
} else {
774+
textureData = blockEntity.profile?.properties?.find(p => p.name === 'textures')?.value
775+
}
776+
if (!textureData) return
772777

773778
try {
774-
const textureData = JSON.parse(Buffer.from(textures.Value, 'base64').toString())
775-
let skinUrl = textureData.textures?.SKIN?.url
779+
const decodedData = JSON.parse(Buffer.from(textureData, 'base64').toString())
780+
let skinUrl = decodedData.textures?.SKIN?.url
776781
const { skinTexturesProxy } = this.worldRendererConfig
777782
if (skinTexturesProxy) {
778783
skinUrl = skinUrl?.replace('http://textures.minecraft.net/', skinTexturesProxy)

0 commit comments

Comments
 (0)