mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-25 13:57:59 +01:00
parent
ab982a4125
commit
1fb6426bea
1 changed files with 12 additions and 4 deletions
|
@ -8,6 +8,8 @@ import java.net.URL;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
@ -61,10 +63,11 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
|
|||
private List<ISkinModifier> skinModifiers = Lists.newArrayList();
|
||||
|
||||
private SkinResourceManager resources = new SkinResourceManager();
|
||||
private ExecutorService executor = Executors.newCachedThreadPool();
|
||||
|
||||
public HDSkinManager() {}
|
||||
|
||||
public Optional<ResourceLocation> getSkinLocation(GameProfile profile1, Type type, boolean loadIfAbsent) {
|
||||
public Optional<ResourceLocation> getSkinLocation(GameProfile profile1, final Type type, boolean loadIfAbsent) {
|
||||
if (!enabled)
|
||||
return Optional.absent();
|
||||
|
||||
|
@ -101,6 +104,9 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
|
|||
if (skin == null) {
|
||||
if (loadIfAbsent) {
|
||||
skinCache.get(profile.getId()).put(type, LOADING);
|
||||
executor.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
loadTexture(profile, type, new SkinAvailableCallback() {
|
||||
@Override
|
||||
public void skinAvailable(Type type, ResourceLocation location, MinecraftProfileTexture profileTexture) {
|
||||
|
@ -108,6 +114,8 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
|
|||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
return Optional.absent();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue