aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/moe/nea/firmament/mixins
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-07-22 16:06:07 +0200
committerLinnea Gräf <nea@nea.moe>2024-07-22 16:06:07 +0200
commit4585a11434f44fa0900351825eb3ca38ce64f187 (patch)
tree29e5997ba56b7dd848f594bf360bb40c3a037cd0 /src/main/java/moe/nea/firmament/mixins
parentd3895dd911b6ef59613bc94feeb2e79b59573c7b (diff)
downloadfirmament-4585a11434f44fa0900351825eb3ca38ce64f187.tar.gz
firmament-4585a11434f44fa0900351825eb3ca38ce64f187.tar.bz2
firmament-4585a11434f44fa0900351825eb3ca38ce64f187.zip
Fix some textures not being loaded to due being misaligned base64 data
Diffstat (limited to 'src/main/java/moe/nea/firmament/mixins')
-rw-r--r--src/main/java/moe/nea/firmament/mixins/TextureUnpackBase64PadPatch.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/main/java/moe/nea/firmament/mixins/TextureUnpackBase64PadPatch.java b/src/main/java/moe/nea/firmament/mixins/TextureUnpackBase64PadPatch.java
new file mode 100644
index 0000000..54b575a
--- /dev/null
+++ b/src/main/java/moe/nea/firmament/mixins/TextureUnpackBase64PadPatch.java
@@ -0,0 +1,24 @@
+/*
+ * SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe>
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+package moe.nea.firmament.mixins;
+
+import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
+import com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService;
+import moe.nea.firmament.util.Base64Util;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+
+@Mixin(value = YggdrasilMinecraftSessionService.class, remap = false)
+public class TextureUnpackBase64PadPatch {
+ @ModifyExpressionValue(method = "unpackTextures",
+ remap = false,
+ at = @At(value = "INVOKE", target = "Lcom/mojang/authlib/properties/Property;value()Ljava/lang/String;"))
+ private String base64PadTexture(String original) {
+ if (original.length() % 4 == 0) return original;
+ return Base64Util.INSTANCE.padToValidBase64(original);
+ }
+}