Support 1.19.1. Remove Vanilla 1.19. (#218)

This commit is contained in:
ZekerZhayard authored and GitHub committed 2022-07-28 09:24:44 +08:00
1 parent 02b24229f3
commit 46b8635e10
21 files changed
+103 -73

No files matched your search

@@ -2,6 +2,7 @@ package customskinloader;
import java.io.File;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
@@ -44,6 +45,8 @@ public class CustomSkinLoader {
private static final ProfileCache profileCache=new ProfileCache();
private static final DynamicSkullManager dynamicSkullManager=new DynamicSkullManager();
private static final ExecutorService THREAD_POOL = new ThreadPoolExecutor(config.threadPoolSize, config.threadPoolSize, 1L, TimeUnit.MINUTES, new LinkedBlockingQueue<>());
//Correct thread name in thread pool
private static final ThreadFactory defaultFactory = Executors.defaultThreadFactory();
private static final ThreadFactory customFactory = r -> {
@@ -59,6 +62,10 @@ public class CustomSkinLoader {
new LinkedBlockingQueue<>(333), customFactory, new ThreadPoolExecutor.DiscardOldestPolicy()
);
public static void loadProfileTextures(Runnable runnable) {
THREAD_POOL.execute(runnable);
}
public static void loadProfileLazily(GameProfile gameProfile, Consumer<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>> consumer) {
String username = gameProfile.getName();
String credential = MinecraftUtil.getCredential(gameProfile);