From 4585a11434f44fa0900351825eb3ca38ce64f187 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Mon, 22 Jul 2024 16:06:07 +0200 Subject: Fix some textures not being loaded to due being misaligned base64 data --- src/main/kotlin/moe/nea/firmament/util/item/SkullItemData.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/main/kotlin/moe/nea/firmament/util/item/SkullItemData.kt') diff --git a/src/main/kotlin/moe/nea/firmament/util/item/SkullItemData.kt b/src/main/kotlin/moe/nea/firmament/util/item/SkullItemData.kt index 551fa1f..291abed 100644 --- a/src/main/kotlin/moe/nea/firmament/util/item/SkullItemData.kt +++ b/src/main/kotlin/moe/nea/firmament/util/item/SkullItemData.kt @@ -23,6 +23,7 @@ import net.minecraft.component.type.ProfileComponent import net.minecraft.item.ItemStack import net.minecraft.item.Items import moe.nea.firmament.Firmament +import moe.nea.firmament.util.Base64Util.padToValidBase64 import moe.nea.firmament.util.assertTrueOr import moe.nea.firmament.util.json.DashlessUUIDSerializer import moe.nea.firmament.util.json.InstantAsLongSerializer @@ -49,14 +50,11 @@ fun GameProfile.setTextures(textures: MinecraftTexturesPayloadKt) { } private val propertyTextures = "textures" -fun String.padBase64(): String { - return this + "=".repeat((4 - (this.length % 4)) % 4) -} fun ItemStack.setEncodedSkullOwner(uuid: UUID, encodedData: String) { assert(this.item == Items.PLAYER_HEAD) val gameProfile = GameProfile(uuid, "LameGuy123") - gameProfile.properties.put(propertyTextures, Property(propertyTextures, encodedData.padBase64())) + gameProfile.properties.put(propertyTextures, Property(propertyTextures, encodedData.padToValidBase64())) this.set(DataComponentTypes.PROFILE, ProfileComponent(gameProfile)) } -- cgit