Fix rendering lag when skull's username is empty. (#324)

This commit is contained in:
ZekerZhayard authored and GitHub committed 2025-01-12 00:10:00 +08:00
1 parent 4d0ebcc1f7
commit 8080aa7ab5
8 files changed
+19 -6

No files matched your search

@@ -1,6 +1,5 @@
package customskinloader.fake.itf;
import java.io.IOException;
import java.io.InputStream;
import java.util.Optional;
@@ -182,10 +182,14 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
String json = new String(Base64.decodeBase64(value), StandardCharsets.UTF_8);
MinecraftTexturesPayload result = GSON.fromJson(json, MinecraftTexturesPayload.class);
if (result == null || TextureUtil.AuthlibField.MINECRAFT_TEXTURES_PAYLOAD_TEXTURES.get(result) == null) {
if (result == null) {
return Maps.newHashMap();
}
return TextureUtil.AuthlibField.MINECRAFT_TEXTURES_PAYLOAD_TEXTURES.get(result);
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> textures = TextureUtil.AuthlibField.MINECRAFT_TEXTURES_PAYLOAD_TEXTURES.get(result);
if (textures == null) {
return Maps.newHashMap();
}
return textures;
}
@Override
@@ -123,7 +123,8 @@ public class DynamicSkullManager {
MinecraftProfileTexture skin = textures.get(MinecraftProfileTexture.Type.SKIN);
String skinUrl = skin.getUrl();
if (!HttpUtil0.isLocal(skinUrl))
return textures;
// Wrap MinecraftProfileTexture to FakeMinecraftProfileTexture
return ModelManager0.fromUserProfile(ModelManager0.toUserProfile(textures));
File skinFile = new File(CustomSkinLoader.DATA_DIR, skinUrl);
if (!skinFile.isFile())
return Maps.newHashMap();
@@ -4,6 +4,7 @@ import net.minecraft.util.ResourceLocation;
public class TextureManager {
public ITextureObject getTexture(ResourceLocation location) { return null; }
public boolean loadTexture(ResourceLocation location, ITextureObject object) { return false; }
public void loadTexture(ResourceLocation location, AbstractTexture texture) {}
public boolean loadTexture(ResourceLocation location, ITextureObject texture) { return false; }
public void registerAndLoad(ResourceLocation resourceLocation, ReloadableTexture reloadableTexture) {}
}
+1
View File
@@ -52,6 +52,7 @@ net/minecraft/client/renderer/texture/SimpleTexture net/minecraft/class_1049
net/minecraft/client/renderer/texture/TextureContents net/minecraft/class_10539
net/minecraft/client/renderer/texture/TextureManager net/minecraft/class_1060
getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; method_4619
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/AbstractTexture;)V method_4616
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z method_4616
registerAndLoad (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ReloadableTexture;)V method_65876
net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/class_1068
+1
View File
@@ -52,6 +52,7 @@ net/minecraft/client/renderer/texture/SimpleTexture net/minecraft/client/rendere
net/minecraft/client/renderer/texture/TextureContents net/minecraft/client/renderer/texture/TextureContents
net/minecraft/client/renderer/texture/TextureManager net/minecraft/client/renderer/texture/TextureManager
getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; func_110581_b
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/AbstractTexture;)V m_118495_
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z func_110579_a
registerAndLoad (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ReloadableTexture;)V registerAndLoad
net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/client/resources/DefaultPlayerSkin
+1
View File
@@ -52,6 +52,7 @@ net/minecraft/client/renderer/texture/SimpleTexture net/minecraft/client/rendere
net/minecraft/client/renderer/texture/TextureContents net/minecraft/client/renderer/texture/TextureContents
net/minecraft/client/renderer/texture/TextureManager net/minecraft/client/renderer/texture/TextureManager
getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; getTexture
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/AbstractTexture;)V register
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z register
registerAndLoad (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ReloadableTexture;)V registerAndLoad
net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/client/resources/DefaultPlayerSkin
@@ -21,6 +21,11 @@ public abstract class MixinSkinTextureDownloader {
)
)
private static void redirect_lambda$registerTextureInManager$2(TextureManager manager, ResourceLocation location, AbstractTexture texture) {
manager.registerAndLoad(location, (ReloadableTexture) FakeInterfaceManager.ResourceLocation_getTexture(location));
Object texture0 = FakeInterfaceManager.ResourceLocation_getTexture(location);
if (texture0 != null) {
manager.registerAndLoad(location, (ReloadableTexture) texture0);
} else {
manager.loadTexture(location, texture);
}
}
}