From 9f77999baf53f3b8488b74c6af48c021a1254dc1 Mon Sep 17 00:00:00 2001 From: Sollace Date: Thu, 5 Oct 2023 20:28:29 +0100 Subject: [PATCH] Fixed tiny silly ponies reverting to normal villagers when they grow up # Conflicts: # src/main/java/com/minelittlepony/client/render/entity/npc/textures/SillyPonyTextureSupplier.java --- .../entity/npc/AbstractNpcRenderer.java | 2 +- .../textures/SillyPonyTextureSupplier.java | 25 ++++++------------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/minelittlepony/client/render/entity/npc/AbstractNpcRenderer.java b/src/main/java/com/minelittlepony/client/render/entity/npc/AbstractNpcRenderer.java index 3b787ea9..5af152b5 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/npc/AbstractNpcRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/entity/npc/AbstractNpcRenderer.java @@ -27,7 +27,7 @@ abstract class AbstractNpcRenderer private final NpcClothingFeature, AbstractNpcRenderer> clothing; public AbstractNpcRenderer(EntityRendererFactory.Context context, String type, TextureSupplier textureSupplier, TextureSupplier formatter) { - super(context, ModelType.getPlayerModel(Race.EARTH).getKey(false), new SillyPonyTextureSupplier<>(textureSupplier, formatter)); + super(context, ModelType.getPlayerModel(Race.EARTH).getKey(false), SillyPonyTextureSupplier.create(textureSupplier, formatter)); entityType = type; clothing = new NpcClothingFeature<>(this, entityType); addFeature(clothing); diff --git a/src/main/java/com/minelittlepony/client/render/entity/npc/textures/SillyPonyTextureSupplier.java b/src/main/java/com/minelittlepony/client/render/entity/npc/textures/SillyPonyTextureSupplier.java index 1750fed8..276a0379 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/npc/textures/SillyPonyTextureSupplier.java +++ b/src/main/java/com/minelittlepony/client/render/entity/npc/textures/SillyPonyTextureSupplier.java @@ -4,22 +4,13 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.util.Identifier; import net.minecraft.village.VillagerDataContainer; -public class SillyPonyTextureSupplier implements TextureSupplier { - - private final TextureSupplier fallback; - - private final Identifier egg; - private final Identifier egg2; - - public SillyPonyTextureSupplier(TextureSupplier fallback, TextureSupplier formatter) { - this.fallback = fallback; - this.egg = formatter.apply("silly_pony"); - this.egg2 = formatter.apply("tiny_silly_pony"); - } - - @Override - public Identifier apply(T entity) { - return isBestPony(entity) ? (entity.isBaby() ? egg2 : egg) : fallback.apply(entity); +public class SillyPonyTextureSupplier { + public static TextureSupplier create(TextureSupplier fallback, TextureSupplier formatter) { + Identifier egg = formatter.apply("silly_pony"); + Identifier egg2 = formatter.apply("tiny_silly_pony"); + return entity -> { + return isBestPony(entity) ? ("Dinky".equals(entity.getCustomName().getString()) ? egg2 : egg) : fallback.apply(entity); + }; } public static boolean isBestPony(LivingEntity entity) { @@ -27,7 +18,7 @@ public class SillyPonyTextureSupplier