Fixed preview skins on 1.19.2

This commit is contained in:
Sollace 2023-04-11 16:50:08 +02:00
parent 37eadf49ab
commit 219193a53e
2 changed files with 18 additions and 8 deletions

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");
}
}

View file

@ -40,7 +40,8 @@ class PonyPreview extends PlayerPreview {
return DefaultSkinGenerator.generateGreyScale(wearable.getDefaultTexture(), wearable.getDefaultTexture(), getExclusion());
}
return super.getDefaultSkin(type, slim);
Identifier skin = getBlankSkin(type, slim);
return DefaultSkinGenerator.generateGreyScale(type == SkinType.SKIN ? DefaultPonySkinHelper.getPonySkin(profile.getId(), slim) : skin, skin, getExclusion());
}
@Override