CodeCrafter47 / TabOverlayCommon

GNU General Public License v3.0
1 stars 5 forks source link

Add command to directly load specific texture into icon Cache #3

Closed Andre601 closed 2 years ago

Andre601 commented 3 years ago

There should be a way to load already existing skin-textures, for example from https://minecraft-heads.com/, into BTLP/ATO without the requirement of having to make your own icon to use. Maybe a command like /btlp loadicon <name> <source> to save the provided <source> as <name> icon would be an idea.

I'm not sure what BTLP/ATO can do here with loading skin info. Like what options would be valid to use? textures.minecraft.net URL? UUID? Base64 code?

Perhaps offering multiple options for the <source> would be good if there can be multiple ways to get and apply the texture. Perhaps /btlp loadicon <name> <playername|UUID> could take whatever skin the player has right now and store/cache this snapshot as this icon?

Maybe another idea could also be to create and store the loaded icon as actual png file in the icons folder? In such a case would <name> be the path to the icon (i.e. folder/name would result in a icon called name.png to be saved in folder)

Benefits of having such a command would mostly be that the icon doesn't need to be "generated" first since the texture already exists...

CodeCrafter47 commented 3 years ago

To load an icon, btlp needs the base64 texture data and a corresponding digital signature from mojang. The website you linked does not have the signature, so we cannot use the skins there (other than downloading the image and generating a new icon from it). If you look e.g. at the mineskin gallery, they provide the texture data and signature, so we could use that.

Instead of adding a command, I think the workflow would be simpler if the user just pastes the required data into the tablist config file. We could have an option to directly put in the texture data and signature. Now this is not very convenient, because those are rather long base64 strings, but someone might find it useful. Another idea would be to accept links to the skin on one of those websites, e.g. https://minesk.in/795765491. That would be easy to use. To implement it we would need to choose the skin list websites we want it to work with and use their api to query the texture data and signature. I know the mineskin api is easy to use, I don't know about other websites. Though we could use just mineskin to get started, switching the icon generation to use mineskin is something I've wanted to do for quite some time and it should make generating them much faster.

Andre601 commented 3 years ago

mineskin would for sure be an idea to use since it offers a lot of features and can improve the speed of creating icons (Iirc does it even have some stuff in it to recognize already saved skins to then just return those... Not sure about that tho)

The question I have now is, what should you do if you move to it? I wouldn't be surprised if there are people and/or plugins using your skin-API thing, so you would probably need to tell them if you plan on discontinuing the API (IF you do that is)

CodeCrafter47 commented 3 years ago

I'm not sure about caching, but their stats do distinguish unique and total requests, so there probably is some caching going on. When making the move to mineskin I would not immediately shut down my own API. I'd probably keep it running until it doesn't receive any requests anymore. I don't know if other people use it, but old versions of BTLP do and they're not going away soon.

Getting back to the main point of this issue, making it easier to use skins available on the internet, would an option to easily use skins from mineskin, as I suggested in my previous comment, by putting the link/ skin id in the config be useful?

Andre601 commented 3 years ago

I'm not sure about caching, but their stats do distinguish unique and total requests, so there probably is some caching going on. When making the move to mineskin I would not immediately shut down my own API. I'd probably keep it running until it doesn't receive any requests anymore. I don't know if other people use it, but old versions of BTLP do and they're not going away soon.

Getting back to the main point of this issue, making it easier to use skins available on the internet, would an option to easily use skins from mineskin, as I suggested in my previous comment, by putting the link/ skin id in the config be useful?

Yes. This could help. The only thing I see an issue with is finding a way to distinguish a mineskin id from a username made of numbers (iirc can you define a player name for the icon, right? Or am I wrong here?)

CodeCrafter47 commented 3 years ago

Yes you can define a playername. My idea would be to use the mineskin link, e.g. https://minesk.in/795765491, for mineskin skins. There's a button in the mineskin gallery to copy those, so that should be easy.

Andre601 commented 3 years ago

Yes you can define a playername. My idea would be to use the mineskin link, e.g. https://minesk.in/795765491, for mineskin skins. There's a button in the mineskin gallery to copy those, so that should be easy.

True, but the component could still become a bit long. So maybe have an additional option like id:<id>? Just to keep it simple.

Andre601 commented 2 years ago

Is this still a relevant thing considering Mineskin is now used for the skin icon generation?

I feel like this idea is kind of obsolete now considering that with Mineskin, the process should be somewhat faster...

Andre601 commented 2 years ago

I'm closing this now as I feel like it became obsolete. With that said will I open another issue regarding the caching stuff that is actually related to a somewhat annoying issue that exists for quite a while now.