Fix some skulls not being properly reskinned
[no changelog]
This commit is contained in:
@@ -47,14 +47,18 @@ fun GameProfile.setTextures(textures: MinecraftTexturesPayloadKt) {
|
|||||||
|
|
||||||
fun decodeProfileTextureProperty(property: Property): MinecraftTexturesPayloadKt? {
|
fun decodeProfileTextureProperty(property: Property): MinecraftTexturesPayloadKt? {
|
||||||
assertTrueOr(property.name == PlayerSkinProvider.TEXTURES) { return null }
|
assertTrueOr(property.name == PlayerSkinProvider.TEXTURES) { return null }
|
||||||
try {
|
return try {
|
||||||
val json = java.util.Base64.getDecoder().decode(property.value).decodeToString()
|
var encodedF: String = property.value
|
||||||
return Firmament.json.decodeFromString<MinecraftTexturesPayloadKt>(json)
|
while (encodedF.length % 4 != 0 && encodedF.last() == '=') {
|
||||||
|
encodedF = encodedF.substring(0, encodedF.length - 1)
|
||||||
|
}
|
||||||
|
val json = java.util.Base64.getDecoder().decode(encodedF).decodeToString()
|
||||||
|
Firmament.json.decodeFromString<MinecraftTexturesPayloadKt>(json)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
// Malformed profile data
|
// Malformed profile data
|
||||||
if (Firmament.DEBUG)
|
if (Firmament.DEBUG)
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
return null
|
null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user