mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 08:14:23 +01:00
Fixed exceptions when resolving armour textures
This commit is contained in:
parent
ac80091587
commit
f75bf7ff15
1 changed files with 14 additions and 12 deletions
|
@ -79,23 +79,25 @@ public class DefaultArmourTextureResolver<T extends LivingEntity> implements IAr
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private Identifier getArmorTexture(String def, @Nullable String type) {
|
private Identifier getArmorTexture(String def, String type) {
|
||||||
|
return HUMAN_ARMOUR.computeIfAbsent(def + "#" + type, s -> {
|
||||||
if (type.isEmpty() || type.equals(def)) {
|
|
||||||
return HUMAN_ARMOUR.computeIfAbsent(def, Identifier::new);
|
|
||||||
}
|
|
||||||
|
|
||||||
return HUMAN_ARMOUR.computeIfAbsent(type, s -> {
|
|
||||||
Identifier modId = new Identifier(s);
|
|
||||||
Identifier defId = new Identifier(def);
|
Identifier defId = new Identifier(def);
|
||||||
|
|
||||||
Path defPath = Paths.get(defId.getPath());
|
if (type.isEmpty() || type.equals(def)) {
|
||||||
|
return defId;
|
||||||
|
}
|
||||||
|
|
||||||
String domain = modId.getNamespace();
|
Identifier modId = new Identifier(type);
|
||||||
|
|
||||||
String path = Paths.get(modId.getPath()).getParent().resolve(defPath.getFileName()).toString().replace('\\', '/');
|
Path modPath = Paths.get(modId.getPath()).getParent();
|
||||||
|
|
||||||
Identifier interemId = new Identifier(domain, path);
|
if (modPath == null) {
|
||||||
|
return defId;
|
||||||
|
}
|
||||||
|
|
||||||
|
Path path = modPath.resolve(Paths.get(defId.getPath()).getFileName());
|
||||||
|
|
||||||
|
Identifier interemId = new Identifier(modId.getNamespace(), path.toString().replace('\\', '/'));
|
||||||
|
|
||||||
if (MinecraftClient.getInstance().getResourceManager().containsResource(interemId)) {
|
if (MinecraftClient.getInstance().getResourceManager().containsResource(interemId)) {
|
||||||
return interemId;
|
return interemId;
|
||||||
|
|
Loading…
Reference in a new issue