2022-12-10 16:45:38 +00:00
|
|
|
package com.minelittlepony.api.pony;
|
|
|
|
|
2024-07-25 15:59:57 +02:00
|
|
|
import net.fabricmc.api.EnvType;
|
|
|
|
import net.fabricmc.api.Environment;
|
2023-09-24 23:43:31 +01:00
|
|
|
import net.minecraft.client.util.DefaultSkinHelper;
|
|
|
|
import net.minecraft.client.util.SkinTextures;
|
2022-12-10 16:45:38 +00:00
|
|
|
import net.minecraft.util.Identifier;
|
2024-04-30 15:45:36 +01:00
|
|
|
import net.minecraft.util.Util;
|
2022-12-10 16:45:38 +00:00
|
|
|
|
2023-09-24 23:43:31 +01:00
|
|
|
import com.minelittlepony.api.pony.meta.Race;
|
|
|
|
|
|
|
|
import java.util.*;
|
2024-04-30 15:45:36 +01:00
|
|
|
import java.util.function.Function;
|
2022-12-10 16:45:38 +00:00
|
|
|
|
2024-07-25 15:59:57 +02:00
|
|
|
@Environment(EnvType.CLIENT)
|
2022-12-10 16:45:38 +00:00
|
|
|
public final class DefaultPonySkinHelper {
|
2024-07-25 15:59:57 +02:00
|
|
|
public static final Identifier STEVE = Pony.id("textures/entity/player/wide/steve_pony.png");
|
2022-12-10 16:45:38 +00:00
|
|
|
|
2024-07-25 15:59:57 +02:00
|
|
|
public static final Identifier SEAPONY_SKIN_TYPE_ID = Pony.id("seapony");
|
|
|
|
public static final Identifier NIRIK_SKIN_TYPE_ID = Pony.id("nirik");
|
2023-09-28 14:07:36 +01:00
|
|
|
|
2024-04-30 15:45:36 +01:00
|
|
|
private static final Function<SkinTextures, SkinTextures> SKINS = Util.memoize(original -> new SkinTextures(
|
2024-07-25 15:59:57 +02:00
|
|
|
Pony.id(original.texture().getPath().replace(".png", "_pony.png")),
|
2024-04-30 15:45:36 +01:00
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
original.model(),
|
|
|
|
false
|
|
|
|
));
|
2023-09-24 23:43:31 +01:00
|
|
|
|
|
|
|
public static SkinTextures getTextures(SkinTextures original) {
|
2024-04-30 15:45:36 +01:00
|
|
|
return SKINS.apply(original);
|
2023-09-24 23:43:31 +01:00
|
|
|
}
|
2022-12-10 16:45:38 +00:00
|
|
|
|
2023-09-24 23:43:31 +01:00
|
|
|
public static String getModelType(UUID id) {
|
2023-12-08 17:23:34 +00:00
|
|
|
SkinTextures textures = DefaultSkinHelper.getSkinTextures(id);
|
2023-09-25 21:07:09 +01:00
|
|
|
return getModelType(Pony.getManager().getPony(textures.texture(), id).race(), textures.model());
|
2022-12-10 16:45:38 +00:00
|
|
|
}
|
|
|
|
|
2023-09-24 23:43:31 +01:00
|
|
|
public static String getModelType(Race race, SkinTextures.Model armShape) {
|
|
|
|
if (race.isHuman()) {
|
|
|
|
return armShape.getName();
|
|
|
|
}
|
|
|
|
return (armShape == SkinTextures.Model.SLIM) ? armShape.getName() + race.name().toLowerCase(Locale.ROOT) : race.name().toLowerCase(Locale.ROOT);
|
2022-12-10 16:45:38 +00:00
|
|
|
}
|
|
|
|
}
|