mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-26 06:18:00 +01:00
Fix #120 (concurrent modification exception when computing villager textures)
This commit is contained in:
parent
ee8e970cee
commit
c3ddc01422
1 changed files with 9 additions and 8 deletions
|
@ -74,8 +74,7 @@ class VillagerProfessionTextureCache<T extends LivingEntity & VillagerDataContai
|
|||
// through all the lambda generations if we can avoid it.
|
||||
}
|
||||
|
||||
return cache.computeIfAbsent(key, k -> {
|
||||
return verifyTexture(formatter.supplyTexture(k)).orElseGet(() -> {
|
||||
Identifier result = verifyTexture(formatter.supplyTexture(key)).orElseGet(() -> {
|
||||
if (type == VillagerType.PLAINS) {
|
||||
// if texture loading fails, use the fallback.
|
||||
return fallback;
|
||||
|
@ -83,7 +82,9 @@ class VillagerProfessionTextureCache<T extends LivingEntity & VillagerDataContai
|
|||
|
||||
return getTexture(VillagerType.PLAINS, profession);
|
||||
});
|
||||
});
|
||||
|
||||
cache.put(key, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected Optional<Identifier> verifyTexture(Identifier texture) {
|
||||
|
|
Loading…
Reference in a new issue