zlainsama / OfflineSkins

This mod allows you to show off your skins even if the server is in offline mode.
https://minecraft.curseforge.com/projects/offlineskins
MIT License
45 stars 18 forks source link

Problem with use OfflineSkins mod #38

Open mkawczynski07 opened 4 years ago

mkawczynski07 commented 4 years ago

Hi. I decided to write an issue because for my kid's setup this mod doesn't work.

We have forge 1.15.2-31.1.63 server. With BetterStorage and Advanced Skin Customization (Forge)(https://www.curseforge.com/minecraft/mc-mods/advanced-skin-customization).
Of course, the server runs in offline mode Some of the friends of my kids don't have a license for Minecraft. Because of that w use T-Launcher without authorization.

I installed OfflineSkin mode on all computers. After first run this mode crated cachedImages/skins directory. I put there all of the skins that kids asked me with proper names(name of the player with png extension. E.g. UserName.png). But nothing happened...

My questions are:

zlainsama commented 4 years ago

It is possible that the Advanced Skin Customization mod is incompatible with OfflineSkins, you can test this by removing it temporarily. Do you put those skin files on all client computers? Also they are case-sensitive.

mkawczynski07 commented 4 years ago

Hi @zlainsama. Thx for the response. I removed Advanced Skin Customization and nothing happened... And yes I put skins on all computers.

Are there any logs that I can check? Also maybe it is because T-Launcher? They have skins for signed users, but we are playing without authorization. T-launcher installs tlskincape_1.15.2-1.11 mod automatically. What do you think?

zlainsama commented 4 years ago

Unfortunately, there are no logs for what skins are applied at runtime. From their websites (translated using google, i can't read Russian), they seem to provide skin services through that mod, and that might be the cause of this incompatibility. Couldn't you use their services for skins? it seems they are free to use.

mkawczynski07 commented 4 years ago

https://tlauncher.org/en/ :) English version.

We use the server without authorization because when we tried to log-in as authorized t-launcher user then we couldn't get access to our Minecraft server.

Frankly, I am new in Minecraft world... Right now kids have achievements and so on. I asked them about moving to new characters and they said that prefer to use current characters.

But anyway I will try to give your mod a chance. I downloaded the source code and did a brief review. I will try to add some logs to your implementation of PlayerProfile. Is it a good place to start?

mkawczynski07 commented 4 years ago

Or maybe I will be able to attach debugger session. It is possible?

zlainsama commented 4 years ago

You should be able to detect if they are actually getting hijacked by my mods' ASM hooks here: https://github.com/zlainsama/OfflineSkins/blob/master/src/main/java/lain/mods/skins/init/forge/Hooks.java

Here are the transformers: https://github.com/zlainsama/OfflineSkins/blob/master/src/main/resources/transformers.js

mkawczynski07 commented 4 years ago

How can I use this transformer? Can you provide me more information?

zlainsama commented 4 years ago

You can add some logs to the Hooks.java and compile then log in to the game with the launcher you are using to see if the game's logic is actually hijacked by the transformers and redirected to those Hooks. If the log is not constantly spammed when a player is being rendered, then it means the automatically installed mod is causing the problem.

mkawczynski07 commented 4 years ago

Ok, now I understand that this transformer should be used when I compile your mod. Ok, all is clear for me. For now of course. I Will let you know about the results.

mkawczynski07 commented 4 years ago

@zlainsama when I downloaded and just build your mod(without any modifications) and put builded jar to my mods directory then Minecraft crashed with:

`> [16:41:13] [Render thread/ERROR] [ne.mi.ev.EventBus/EVENTBUS]: Exception caught during firing event: net.minecraft.client.Minecraft.getInstance()Lnet/minecraft/client/Minecraft;

Index: 2 Listeners: 0: NORMAL 1: ASM: net.minecraftforge.common.ForgeInternalHandler@4ef8c98d checkSettings(Lnet/minecraftforge/event/TickEvent$ClientTickEvent;)V 2: net.minecraftforge.eventbus.EventBus$$Lambda$2088/1919135940@45cce4c2 3: ASM: com.mamiyaotaru.voxelmap.forgemod.TickHandler@682fc714 onTick(Lnet/minecraftforge/event/TickEvent$ClientTickEvent;)V 4: ASM: com.mercy194.main.SteinEventHandler@8d3d6eb clientTickEvent(Lnet/minecraftforge/event/TickEvent$ClientTickEvent;)V java.lang.NoSuchMethodError: net.minecraft.client.Minecraft.getInstance()Lnet/minecraft/client/Minecraft; at lain.mods.skins.init.forge.Proxy.handleClientTickEvent(Proxy.java:107) at lain.mods.skins.init.forge.Proxy$$Lambda$3027/1029309217.accept(Unknown Source) at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:212) at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:204) at net.minecraftforge.eventbus.EventBus$$Lambda$2088/1919135940.invoke(Unknown Source) at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) at net.minecraftforge.fml.hooks.BasicEventHooks.onPreClientTick(BasicEventHooks.java:104) at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1330) at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:905) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:554) at net.minecraft.client.main.Main.main(SourceFile:204) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:56) at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$426/1707901480.call(Unknown Source) at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) at cpw.mods.modlauncher.Launcher.main(Launcher.java:65)

[16:41:13] [Render thread/FATAL] [minecraft/Minecraft]: Unreported exception thrown! java.lang.NoSuchMethodError: net.minecraft.client.Minecraft.getInstance()Lnet/minecraft/client/Minecraft; at lain.mods.skins.init.forge.Proxy.handleClientTickEvent(Proxy.java:107) ~[?:1.15.2-v1] {re:classloading} at lain.mods.skins.init.forge.Proxy$$Lambda$3027/1029309217.accept(Unknown Source) ~[?:?] {} at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:212) ~[eventbus-2.0.0-milestone.1-service.jar:?] {} at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:204) ~[eventbus-2.0.0-milestone.1-service.jar:?] {} at net.minecraftforge.eventbus.EventBus$$Lambda$2088/1919135940.invoke(Unknown Source) ~[?:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) ~[eventbus-2.0.0-milestone.1-service.jar:?] {} at net.minecraftforge.fml.hooks.BasicEventHooks.onPreClientTick(BasicEventHooks.java:104) ~[?:?] {re:classloading} at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1330) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:905) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:554) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(SourceFile:204) [?:?] {re:classloading} at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51] {} at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51] {} at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51] {} at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51] {} at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:56) [forge-1.15.2-31.1.46.jar:31.1] {} at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$426/1707901480.call(Unknown Source) [forge-1.15.2-31.1.46.jar:31.1] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-5.0.0-milestone.4.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-5.0.0-milestone.4.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-5.0.0-milestone.4.jar:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-5.0.0-milestone.4.jar:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-5.0.0-milestone.4.jar:?] {} [16:41:15] [Render thread/INFO] [STDOUT/]: [net.minecraft.util.registry.Bootstrap:func_179870_a:103]: ---- Minecraft Crash Report ---- // But it works on my machine.

Time: 06.05.20 16:41 Description: Unexpected error

java.lang.NoSuchMethodError: net.minecraft.client.Minecraft.getInstance()Lnet/minecraft/client/Minecraft; at lain.mods.skins.init.forge.Proxy.handleClientTickEvent(Proxy.java:107) ~[?:1.15.2-v1] {re:classloading} at lain.mods.skins.init.forge.Proxy$$Lambda$3027/1029309217.accept(Unknown Source) ~[?:?] {} at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:212) ~[eventbus-2.0.0-milestone.1-service.jar:?] {} at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:204) ~[eventbus-2.0.0-milestone.1-service.jar:?] {} at net.minecraftforge.eventbus.EventBus$$Lambda$2088/1919135940.invoke(Unknown Source) ~[?:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) ~[eventbus-2.0.0-milestone.1-service.jar:?] {} at net.minecraftforge.fml.hooks.BasicEventHooks.onPreClientTick(BasicEventHooks.java:104) ~[?:?] {re:classloading} at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1330) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:905) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:554) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(SourceFile:204) [?:?] {re:classloading} at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51] {} at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51] {} at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51] {} at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51] {} at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:56) [forge-1.15.2-31.1.46.jar:31.1] {} at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$426/1707901480.call(Unknown Source) [forge-1.15.2-31.1.46.jar:31.1] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-5.0.0-milestone.4.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-5.0.0-milestone.4.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-5.0.0-milestone.4.jar:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-5.0.0-milestone.4.jar:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-5.0.0-milestone.4.jar:?] {}`

Should I do something else?

net.minecraft.client.Minecraft.getInstance()Lnet/minecraft/client/Minecraft;

from your proxy code. Any ideas?

zlainsama commented 4 years ago

Does that happen on a clean minecraft forge instance? Which version of java are you using when building? You should use java 8.

mkawczynski07 commented 4 years ago

When I built with java 8 I have the same exception.

> -- System Details --
> Details:
>   Minecraft Version: 1.15.2
>   Minecraft Version ID: 1.15.2
>   Operating System: Linux (amd64) version 4.15.0-29-generic
>   Java Version: 1.8.0_51, Oracle Corporation
>   Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
>   Memory: 31445039840 bytes (29988 MB) / 32480690176 bytes (30976 MB) up to 32480690176 bytes (30976 MB)
>   CPUs: 12
>   JVM Flags: 9 total; -Xmn128M -Xmx30970M -Xss1M -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M
>   ModLauncher: 5.0.0-milestone.4+67+b1a340b
>   ModLauncher launch target: fmlclient
>   ModLauncher naming: srg
>   ModLauncher services: 
>       /eventbus-2.0.0-milestone.1-service.jar eventbus PLUGINSERVICE 
>       /forge-1.15.2-31.1.46.jar object_holder_definalize PLUGINSERVICE 
>       /forge-1.15.2-31.1.46.jar runtime_enum_extender PLUGINSERVICE 
>       /accesstransformers-2.0.4-shadowed.jar accesstransformer PLUGINSERVICE 
>       /forge-1.15.2-31.1.46.jar capability_inject_definalize PLUGINSERVICE 
>       /forge-1.15.2-31.1.46.jar runtimedistcleaner PLUGINSERVICE 
>       /forge-1.15.2-31.1.46.jar fml TRANSFORMATIONSERVICE 
>   FML: 31.1
>   Forge: net.minecraftforge:31.1.46
>   FML Language Providers: 
>       javafml@31.1
>       minecraft@1
>   Mod List: 
>       forge-1.15.2-31.1.46-client.jar Minecraft {minecraft@1.15.2 DONE}
>       OfflineSkins-1.15.2-v1.jar OfflineSkins {offlineskins@1.15.2-v1 DONE}
>       forgemod_VoxelMap-1.9.16_for_1.15.2.jar VoxelMap {voxelmap@1.9.16 DONE}
>       forge-1.15.2-31.1.46-universal.jar Forge {forge@31.1.46 DONE}
>       BetterStorageToo-1.15.2-5.0.0.1.jar BetterStorageToo {betterstorage@1.15.2-5.0.0.1 DONE}
>       Inventory-Tweaks-Reborn-Mod-1.15.2.jar Inventory Tweaks Reborn {invtweaks@1.15.2-1.0.1 DONE}
>       damage_indicator-0.0.9.jar Ama's Damage Indicator {damage_indicator@0.0.9 DONE}
>       tlskincape_1.15.2-1.11.jar TLSkinCape {tlskincape@1.6 DONE}
>       AdvancedSkinCustomization-2.8.2.jar Advanced Skin Customization {advskinmod@2.8.2 DONE}
>   Launched Version: Forge 1.15.2
>   Backend library: LWJGL version 3.2.2 build 10
>   Backend API: GeForce GTX 1050 Ti/PCIe/SSE2 GL version 4.6.0 NVIDIA 390.87, NVIDIA Corporation
>   GL Caps: Using framebuffer using OpenGL 3.0
>   Using VBOs: Yes
>   Is Modded: Definitely; Client brand changed to 'forge'
>   Type: Client (map_client.txt)
>   Resource Packs: vanilla, mod_resources

When I run this only with OfflineSkin mod then result is the same. Maybe you should try to build on your environment. But before please try to clean all Gradle cached libraries.

mkawczynski07 commented 4 years ago

@zlainsama I fixed the problem. :) I compered your build.gradle with initial from forge SDK. I found that you miss jar.finalizedBy('reobfJar'). That helped me to run mod.

I have log from ForgeOfflineSkins, so mod is loaded.

> [22:03:39] [modloading-worker-9/INFO] [STDOUT/]: [lain.mods.skins.init.forge.ForgeOfflineSkins:setupClient:18]: >>>>>>>>>>>>>> ForgeOfflineSkins.setUp

But when I joined the server then nothing from Hooks. Only this:

> [22:05:23] [Render thread/INFO] [minecraft/ConnectingScreen]: Connecting to 192.168.0.18, 25565
> [22:05:25] [Netty Epoll Client IO #0/WARN] [ne.mi.co.ForgeConfigSpec/CORE]: Configuration file SimpleCommentedConfig:{server=SimpleCommentedConfig:{dimensionUnloadQueueDelay=0, zombieBaseSummonChance=0.1, zombieBabyChance=0.05, removeErroringEntities=false, fullBoundingBoxLadders=false, fixAdvancementLoading=true, logCascadingWorldGeneration=true, treatEmptyTagsAsAir=false, clumpingThreshold=64, removeErroringTileEntities=false, fixVanillaCascading=false}} is not correct. Correcting
> [22:05:25] [Netty Epoll Client IO #0/WARN] [ne.mi.co.ForgeConfigSpec/CORE]: Incorrect key server.fixAdvancementLoading was corrected from true to null
> [22:05:25] [Netty Epoll Client IO #0/INFO] [ne.mi.fm.ne.NetworkHooks/]: Connected to a modded server.
> [22:05:26] [Netty Epoll Client IO #0/ERROR] [minecraft/ArgumentTypes]: Could not deserialize minecraft:
> [22:05:26] [Netty Epoll Client IO #0/ERROR] [minecraft/ArgumentTypes]: Could not deserialize minecraft:
> [22:05:26] [Render thread/INFO] [minecraft/AdvancementList]: Loaded 564 advancements
> [22:05:27] [Render thread/INFO] [STDOUT/]: [com.mamiyaotaru.voxelmap.forgemod.WorldIDPacket:encode:24]: encoding id packet
> [22:05:27] [Render thread/INFO] [or.tl.re.TextureManager/]: textures 'Tata' was added, skin: true,cape: false, max waiting: 1 ,during : 477 

or.tl.re.TextureManager sounds like this is from T-launcher. I'm totally newbie in Minecraft, forge API, but maybe t-launcher override your transformations?

zlainsama commented 4 years ago

Yes, that would be the case. You can try to alter the filenames to get a different loading order and see if that can help this situation.

mkawczynski07 commented 4 years ago

What files exactly?

zlainsama commented 4 years ago

Like changing OfflineSkins-XXXX.jar to Z_OfflineSkins-XXXX.jar. This would work if that skin mod is not requesting to be loaded at last.

mkawczynski07 commented 4 years ago

Stil the same:

> [11:26:06] [Render thread/INFO] [or.tl.re.TextureManager/]: textures 'Tata' was added, skin: true,cape: false, max waiting: 1 ,during : 421 
mkawczynski07 commented 4 years ago

@zlainsama I followed those instructions: https://tlauncher.org/en/activate-system-skins.html and now I have logs from Hooks class so I believe your mode is running. Unfortunately, the skin doesn't change...

zlainsama commented 4 years ago

Those instructions seem to be for enabling their skin mod... Can you try running a instance without that and check the log file to see if their skin mod is loaded?

mkawczynski07 commented 4 years ago

False means that the system skins is disabled, and true that included.

So I have this option set to false. And for a ~1s after I run the game I can see skin that is provided from cachedImages by your mod. But after that is changed to default.

And as I wrote. Now I have logs from Hooks class on the console.

/edit

Right now I have only one mod(OfflineSkin) loaded. T-launcher skin mod is not loaded and the problem I still the same. After I join the game I can see the skin but after ~1 second it changes to default.

zlainsama commented 4 years ago

Can you try set all "useXXXX" to "false" in the config file? this way, it will only use the files in the cachedImages folder and when it failed to do so, it will let the game revert back to vanilla logic.

mkawczynski07 commented 4 years ago

Didn't help.

I added logs like this:

    public static ResourceLocation getLocationCape(AbstractClientPlayerEntity player, ResourceLocation result) {
        ResourceLocation loc = Proxy.INSTANCE.getLocationCape(player.getGameProfile());
        log(">>>>> Hooks.getLocationCape loc " + (loc != null ? loc : null));
        log(">>>>> Hooks.getLocationCape player " + (player != null ? player : null));
        log(">>>>> Hooks.getLocationCape result " + (result != null ? result : null));

        if (loc != null)
            return loc;
        return result;
    }

    public static ResourceLocation getLocationSkin(AbstractClientPlayerEntity player, ResourceLocation result) {
        ResourceLocation loc = Proxy.INSTANCE.getLocationSkin(player.getGameProfile());

        log(">>>>> Hooks.getLocationSkin loc " + (loc != null ? loc : null));
        log(">>>>> Hooks.getLocationSkin player " + (player != null ? player : null));
        log(">>>>> Hooks.getLocationSkin result " + (result != null ? result : null));
        if (loc != null)
            return loc;
        return result;
    }

    public static ResourceLocation getLocationSkin_SkullRenderer(SkullBlock.ISkullType type, GameProfile profile, ResourceLocation result) {
        log(">>>>> Hooks.getLocationSkin_SkullRenderer type " + (type != null ? type : null));
        log(">>>>> Hooks.getLocationSkin_SkullRenderer player " + (profile != null ? profile : null));
        log(">>>>> Hooks.getLocationSkin_SkullRenderer result " + (result != null ? result : null));

        if (SkullBlock.Types.PLAYER == type && profile != null) {
            ResourceLocation loc = Proxy.INSTANCE.getLocationSkin(profile);
            log(">>>>> Hooks.getLocationSkin_SkullRenderer loc " + (loc != null ? loc : null));
            if (loc != null)
                return loc;
        }
        return result;
    }

    public static ResourceLocation getLocationSkin_TabOverlay(GameProfile profile, ResourceLocation result) {
        ResourceLocation loc = Proxy.INSTANCE.getLocationSkin(profile);
        log(">>>>> Hooks.getLocationSkin_TabOverlay loc " + (loc != null ? loc : null));
        log(">>>>> Hooks.getLocationSkin_TabOverlay profile " + (profile != null ? profile : null));
        log(">>>>> Hooks.getLocationSkin_TabOverlay result " + (result != null ? result : null));
        if (loc != null)
            return loc;
        return result;
    }

    public static String getSkinType(AbstractClientPlayerEntity player, String result) {
        log(">>>>> Hooks.getSkinType player " + (player != null ? player : null));
        log(">>>>> Hooks.getSkinType result " + (result != null ? result : null));

        String type = Proxy.INSTANCE.getSkinType(player.getGameProfile());
        log(">>>>> Hooks.getSkinType type " + (type != null ? type : null));

        if (type != null)
            return type;
        return result;
    }

and

    @Override
    public ISkin getSkin(IPlayerProfile profile)
    {
        log(">>>>>. getSkin");
        SkinData skin = new SkinData();
        if (_filter != null)
            skin.setSkinFilter(_filter);
        SharedPool.execute(() -> {
            byte[] data = null;
            log(">>>>>. getSkin isOffline: "+!Shared.isOfflinePlayer(profile.getPlayerID(), profile.getPlayerName()));
            log(">>>>>. getSkin isBlank: "+!Shared.isBlank(profile.getPlayerName()));
            if (!Shared.isOfflinePlayer(profile.getPlayerID(), profile.getPlayerName()))
                data = readFile(_dirU, "%s.png", profile.getPlayerID().toString().replaceAll("-", ""));
            if (data == null && !Shared.isBlank(profile.getPlayerName()))
                data = readFile(_dirN, "%s.png", profile.getPlayerName());
            if (data != null)
                skin.put(data, ImageUtils.judgeSkinType(data));
        });
        return skin;
    }

    private byte[] readFile(File dir, String filename)
    {
        log("readFile dir > "+ dir.getAbsolutePath());
        log("readFile filename > "+ filename);

        byte[] contents;
        if ((contents = Shared.blockyReadFile(new File(dir, filename), null, null)) != null && ImageUtils.validateData(contents)) {
            log("readFile contents");
            return contents;
        }
        log("readFile null");
        return null;
    }

logs:

>>>>> Hooks.getLocationSkin loc null
>>>>> Hooks.getLocationSkin player ClientPlayerEntity['Tata'/1735, l='MpServer', x=463.51, y=56.00, z=131.83]
>>>>> Hooks.getLocationSkin result minecraft:textures/entity/alex.png
>>>>> Hooks.getLocationCape loc null
>>>>> Hooks.getLocationCape player ClientPlayerEntity['Tata'/1735, l='MpServer', x=463.51, y=56.00, z=131.83]
>>>>> Hooks.getLocationCape result null
>>>>> Hooks.getSkinType player ClientPlayerEntity['Tata'/1735, l='MpServer', x=463.51, y=56.00, z=131.83]
>>>>> Hooks.getSkinType result slim
>>>>> Hooks.getSkinType type null
>>>>> Hooks.getLocationSkin loc null
>>>>> Hooks.getLocationSkin player ClientPlayerEntity['Tata'/1735, l='MpServer', x=463.51, y=56.00, z=131.83]
>>>>> Hooks.getLocationSkin result minecraft:textures/entity/alex.png
>>>>> Hooks.getLocationCape loc null
>>>>> Hooks.getLocationCape player ClientPlayerEntity['Tata'/1735, l='MpServer', x=463.51, y=56.00, z=131.83]
>>>>> Hooks.getLocationCape result null
>>>>> Hooks.getLocationSkin loc null
>>>>> Hooks.getLocationSkin player ClientPlayerEntity['Tata'/1735, l='MpServer', x=463.51, y=56.00, z=131.83]
>>>>> Hooks.getLocationSkin result minecraft:textures/entity/alex.png
>>>>> Hooks.getLocationSkin loc null
>>>>> Hooks.getLocationSkin player ClientPlayerEntity['Tata'/1735, l='MpServer', x=463.51, y=56.00, z=131.83]
>>>>> Hooks.getLocationSkin result minecraft:textures/entity/alex.png
>>>>>. getSkin
>>>>>. getSkin isOffline: true
>>>>>. getSkin isBlank: true
readFile dir > /home/marek/.minecraft/./cachedImages/skins/uuid
readFile filename > c557d99e9a6548df8bac3429f592d595.png
readFile contents
>>>>> Hooks.getSkinType player ClientPlayerEntity['Tata'/1735, l='MpServer', x=463.51, y=56.00, z=131.83]
>>>>> Hooks.getSkinType result slim
>>>>> Hooks.getSkinType type null
>>>>> Hooks.getSkinType player ClientPlayerEntity['Tata'/1735, l='MpServer', x=463.51, y=56.00, z=131.83]
>>>>> Hooks.getSkinType result slim
>>>>> Hooks.getSkinType type null
>>>>> Hooks.getSkinType player ClientPlayerEntity['Tata'/1735, l='MpServer', x=463.51, y=56.00, z=131.83]
>>>>> Hooks.getSkinType result slim
>>>>> Hooks.getSkinType type null
>>>>> Hooks.getLocationSkin loc null
>>>>> Hooks.getLocationSkin player ClientPlayerEntity['Tata'/1735, l='MpServer', x=463.51, y=56.00, z=131.83]
>>>>> Hooks.getLocationSkin result minecraft:textures/entity/alex.png
>>>>> Hooks.getLocationCape loc null
>>>>> Hooks.getLocationCape player ClientPlayerEntity['Tata'/1735, l='MpServer', x=463.51, y=56.00, z=131.83]
>>>>> Hooks.getLocationCape result null
>>>>> Hooks.getSkinType player ClientPlayerEntity['Tata'/1735, l='MpServer', x=463.51, y=56.00, z=131.83]
>>>>> Hooks.getSkinType result slim
>>>>> Hooks.getSkinType type null

I added tata.png and 'c557d99e9a6548df8bac3429f592d595.png' but that also didn't help. Also why at first this: !Shared.isOfflinePlayer(profile.getPlayerID(), profile.getPlayerName()) is false and for second call it is true?

zlainsama commented 4 years ago

https://github.com/zlainsama/OfflineSkins/blob/master/src/main/java/lain/mods/skins/impl/PlayerProfile.java https://github.com/zlainsama/OfflineSkins/blob/master/src/main/java/lain/mods/skins/impl/MojangService.java Offline players' username will be sent to Mojang to be resolved to a proper online profile. Incomplete profiles will also be sent to Mojang to be filled to a proper complete profile.

log(">>>>>. getSkin isOffline: "+!Shared.isOfflinePlayer(profile.getPlayerID(), profile.getPlayerName()));
log(">>>>>. getSkin isBlank: "+!Shared.isBlank(profile.getPlayerName()));

Also you are logging inverted values.

https://github.com/zlainsama/OfflineSkins/blob/master/src/main/java/lain/mods/skins/impl/SkinData.java#L55-L68 You can add some logs here to see if the skin file is getting put on the SkinData, also check if the conversion failed and broke the file.

mkawczynski07 commented 4 years ago

Works... :D I realized that I was building the mod with java 10 and there was an exception on console that I didn't saw at the beginning. "Method not found". I changed to Java 8 and now it works. :d

To summarize if someone would like to use that mod with T-Launcher then the T-Launcher skin's mechanism must be turned off as described here:https://tlauncher.org/en/activate-system-skins.html .

Thanks for all your help!