Fixed load order not visiting old pony textures before the rest

This commit is contained in:
Sollace 2020-04-17 15:30:31 +02:00
parent 5d88aedfbf
commit 982a393558
3 changed files with 8 additions and 8 deletions

View file

@ -42,16 +42,16 @@ public class DefaultArmourTextureResolver<T extends LivingEntity> implements IAr
String customType = type.isEmpty() ? "" : String.format("_%s", type); String customType = type.isEmpty() ? "" : String.format("_%s", type);
String ponyRes = String.format("%s:textures/models/armor/%s_layer_%s%s.png", domain, texture, layer.name().toLowerCase(), customType); String res = String.format("%s:textures/models/armor/%s_layer_%s%s.png", domain, texture, layer.name().toLowerCase(), customType);
String oldPonyRes = String.format("%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, layer == ArmourLayer.INNER ? 2 : 1, customType); String oldRes = String.format("%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, layer == ArmourLayer.INNER ? 2 : 1, customType);
Identifier human = getArmorTexture(ponyRes, type); Identifier human = getArmorTexture(res, type);
Identifier pony = ponifyResource(human); Identifier pony = ponifyResource(human);
Identifier oldHuman = getArmorTexture(oldPonyRes, type); Identifier oldHuman = getArmorTexture(oldRes, type);
Identifier oldPony = ponifyResource(oldHuman); Identifier oldPony = ponifyResource(oldHuman);
return resolve(pony, oldPony, oldHuman, human); return resolve(oldPony, pony, oldHuman, human);
} }
private Identifier resolve(Identifier... resources) { private Identifier resolve(Identifier... resources) {

View file

@ -27,7 +27,7 @@ import net.minecraft.util.Identifier;
public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends AbstractPonyFeature<T, M> { public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends AbstractPonyFeature<T, M> {
private static final IArmourTextureResolver<LivingEntity> textures = new DefaultArmourTextureResolver<>(); public static final IArmourTextureResolver<LivingEntity> DEFAULT = new DefaultArmourTextureResolver<>();
public ArmourFeature(IPonyRenderContext<T, M> renderer) { public ArmourFeature(IPonyRenderContext<T, M> renderer) {
super(renderer); super(renderer);
@ -58,7 +58,7 @@ public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & IP
armour.setAngles(entity, limbAngle, limbDistance, age, headYaw, headPitch); armour.setAngles(entity, limbAngle, limbDistance, age, headYaw, headPitch);
armour.synchroniseLegs(pony.getBody()); armour.synchroniseLegs(pony.getBody());
IArmourTextureResolver<T> resolver = armour instanceof IArmourTextureResolver ? (IArmourTextureResolver<T>)armour : (IArmourTextureResolver<T>)textures; IArmourTextureResolver<T> resolver = armour instanceof IArmourTextureResolver ? (IArmourTextureResolver<T>)armour : (IArmourTextureResolver<T>)DEFAULT;
Identifier armourTexture = resolver.getArmourTexture(entity, itemstack, armorSlot, layer, null); Identifier armourTexture = resolver.getArmourTexture(entity, itemstack, armorSlot, layer, null);
armour.setVariant(resolver.getArmourVariant(layer, armourTexture)); armour.setVariant(resolver.getArmourVariant(layer, armourTexture));