aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/moe/nea/firmament/mixins/TextureUnpackBase64PadPatch.java
blob: 43ce9508aa82274464982ec67ae74ff492da319f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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);
    }
}