Allow APortingCore to load CustomSkinLoader. (#112)

This commit is contained in:
ZekerZhayard authored and GitHub committed 2020-08-24 11:52:23 +08:00
1 parent dc6d135699
commit 83042f45bd
3 files changed
+22 -20

No files matched your search

+5 -5
View File
@@ -4,6 +4,8 @@ import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -97,10 +99,8 @@ public class Logger {
warning(String.format(format, objs));
}
public void warning(Throwable e){
log(Level.WARNING,"Exception: "+e.toString());
StackTraceElement[] stes=e.getStackTrace();
for(StackTraceElement ste : stes){
log(Level.WARNING,ste.toString());
}
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
log(Level.WARNING,"Exception: "+sw.toString());
}
}
@@ -63,22 +63,24 @@ public class FakeSkinManager {
}
public void loadProfileTextures(final GameProfile profile, final SkinAvailableCallback skinAvailableCallback, final boolean requireSecure) {
THREAD_POOL.execute(new Runnable() {
public void run() {
final Map<Type, MinecraftProfileTexture> map = Maps.newHashMap();
map.putAll(customskinloader.CustomSkinLoader.loadProfile(profile));
THREAD_POOL.execute(() -> {
final Map<Type, MinecraftProfileTexture> map = Maps.newHashMap();
map.putAll(CustomSkinLoader.loadProfile(profile));
for (MinecraftProfileTexture.Type type : MinecraftProfileTexture.Type.values()) {
MinecraftProfileTexture profileTexture = map.get(type);
if (profileTexture != null) {
HttpTextureInfo info = HttpTextureUtil.toHttpTextureInfo(profileTexture.getUrl());
FakeThreadDownloadImageData.downloadTexture(info.cacheFile, info.url);
for (MinecraftProfileTexture.Type type : MinecraftProfileTexture.Type.values()) {
MinecraftProfileTexture profileTexture = map.get(type);
if (profileTexture != null) {
HttpTextureInfo info = HttpTextureUtil.toHttpTextureInfo(profileTexture.getUrl());
FakeThreadDownloadImageData.downloadTexture(info.cacheFile, info.url);
((IFakeMinecraft) Minecraft.getMinecraft()).execute(() -> {
CustomSkinLoader.logger.debug("Loading type:" + type);
FakeSkinManager.this.loadSkin(profileTexture, info, type, skinAvailableCallback);
});
}
((IFakeMinecraft) Minecraft.getMinecraft()).execute(() -> {
CustomSkinLoader.logger.debug("Loading type: " + type);
try {
this.loadSkin(profileTexture, info, type, skinAvailableCallback);
} catch (Throwable t) {
CustomSkinLoader.logger.warning(t);
}
});
}
}
});
@@ -57,7 +57,7 @@ public class LaunchWrapper implements IClassTransformer {
}
//Parse Class Node to bytes
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
cn.accept(cw);
return cw.toByteArray();
}