mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 04:27:59 +01:00
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
This commit is contained in:
parent
fa0c903c0f
commit
9f77999baf
2 changed files with 9 additions and 18 deletions
|
@ -27,7 +27,7 @@ abstract class AbstractNpcRenderer<T extends MobEntity & VillagerDataContainer>
|
|||
private final NpcClothingFeature<T, ClientPonyModel<T>, AbstractNpcRenderer<T>> clothing;
|
||||
|
||||
public AbstractNpcRenderer(EntityRendererFactory.Context context, String type, TextureSupplier<T> textureSupplier, TextureSupplier<String> 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);
|
||||
|
|
|
@ -4,22 +4,13 @@ import net.minecraft.entity.LivingEntity;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.village.VillagerDataContainer;
|
||||
|
||||
public class SillyPonyTextureSupplier<T extends LivingEntity & VillagerDataContainer> implements TextureSupplier<T> {
|
||||
|
||||
private final TextureSupplier<T> fallback;
|
||||
|
||||
private final Identifier egg;
|
||||
private final Identifier egg2;
|
||||
|
||||
public SillyPonyTextureSupplier(TextureSupplier<T> fallback, TextureSupplier<String> 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 <T extends LivingEntity & VillagerDataContainer> TextureSupplier<T> create(TextureSupplier<T> fallback, TextureSupplier<String> 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<T extends LivingEntity & VillagerDataConta
|
|||
return false;
|
||||
}
|
||||
String name = entity.getCustomName().getString();
|
||||
return "Derpy".equals(name) || (entity.isBaby() && "Dinky".equals(name));
|
||||
return "Derpy".equals(name) || "Dinky".equals(name);
|
||||
}
|
||||
|
||||
public static boolean isCrownPony(LivingEntity entity) {
|
||||
|
|
Loading…
Reference in a new issue