Fixed preview skins on 1.19.2

This commit is contained in:
Sollace 2023-04-11 16:50:08 +02:00
parent 58206c52cd
commit 1564c20876
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB

View file

@ -1,20 +1,29 @@
package com.minelittlepony.api.pony;
import net.minecraft.client.util.DefaultSkinHelper;
import net.minecraft.util.Identifier;
import java.util.HashMap;
import java.util.Map;
import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.settings.PonyLevel;
import java.util.*;
public final class DefaultPonySkinHelper {
public static final Identifier STEVE = new Identifier("minelittlepony", "textures/entity/player/wide/steve_pony.png");
private static final Map<Identifier, Identifier> SKINS = new HashMap<>();
@Deprecated
public static final Identifier ALEX = new Identifier("minelittlepony", "textures/entity/player/slim/alex_pony.png");
public static Identifier getPonySkin(Identifier original) {
return SKINS.computeIfAbsent(original, DefaultPonySkinHelper::computePonySkin);
return original.getPath().contains("steve") ? STEVE : ALEX;
}
private static Identifier computePonySkin(Identifier original) {
return new Identifier("minelittlepony", original.getPath().replace(".png", "_pony.png"));
}
@Deprecated
public static Identifier getPonySkin(UUID profileId, boolean slimArms) {
if (MineLittlePony.getInstance().getConfig().ponyLevel.get() != PonyLevel.PONIES) {
return DefaultSkinHelper.getTexture(profileId);
}
boolean alex = (profileId.hashCode() & 1) == 1;
return new Identifier("minelittlepony", "textures/entity/player/" + (slimArms ? "slim" : "wide") + "/" + (alex ? "alex" : "steve") + "_pony.png");
}
}