Only use a player's skin if it's ponified skin. (Human skins don't fit villagers). Fixes #228

This commit is contained in:
Sollace 2023-02-25 22:06:51 +00:00
parent 86b2cc16dc
commit 28852597a7

View file

@ -5,14 +5,11 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import com.minelittlepony.api.config.PonyConfig;
import com.minelittlepony.api.config.PonyLevel;
import com.minelittlepony.api.pony.IPony; import com.minelittlepony.api.pony.IPony;
import com.minelittlepony.client.SkinsProxy; import com.minelittlepony.client.SkinsProxy;
import com.minelittlepony.util.FunctionUtil; import com.minelittlepony.util.FunctionUtil;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import java.util.*;
import java.util.function.Function; import java.util.function.Function;
public class PlayerTextureSupplier { public class PlayerTextureSupplier {
@ -28,13 +25,10 @@ public class PlayerTextureSupplier {
} }
static final class Entry { static final class Entry {
private final UUID uuid;
@Nullable @Nullable
private GameProfile profile; private GameProfile profile;
Entry(LivingEntity entity) { Entry(LivingEntity entity) {
uuid = entity.getUuid();
SkullBlockEntity.loadProperties(new GameProfile(null, entity.getCustomName().getString()), resolved -> { SkullBlockEntity.loadProperties(new GameProfile(null, entity.getCustomName().getString()), resolved -> {
profile = resolved; profile = resolved;
}); });
@ -44,12 +38,7 @@ public class PlayerTextureSupplier {
public Identifier getTexture() { public Identifier getTexture() {
if (profile != null) { if (profile != null) {
Identifier skin = SkinsProxy.instance.getSkinTexture(profile); Identifier skin = SkinsProxy.instance.getSkinTexture(profile);
if (skin != null) { if (skin != null && !IPony.getManager().getPony(skin).race().isHuman()) {
if (IPony.getManager().getPony(skin).race().isHuman()) {
if (PonyConfig.getInstance().ponyLevel.get() == PonyLevel.PONIES) {
return IPony.getManager().getBackgroundPony(uuid).texture();
}
}
return skin; return skin;
} }
} }