nmsr-rs icon indicating copy to clipboard operation
nmsr-rs copied to clipboard

Support Optifine Cape

Open killerprojecte opened this issue 10 months ago • 3 comments

with parameter ?optifine=true will render optifine cape if player have it

Cape API: https://optifine.net/capes/.png

Example Links: https://optifine.net/capes/Notch.png https://optifine.net/capes/BadBoyHalo.png

I think default cape / custom (banner) cape are not same type (with different size)

killerprojecte avatar Apr 21 '24 14:04 killerprojecte

Hey, sorry for not answering this sooner.

Originally I wasn't going to implement optifine support as I don't want to limit things to a single mod.

I think default cape / custom (banner) cape are not same type (with different size)

Regarding this, I did go ahead and check the image resolutions and the result was this:

Name Resolution
Default 46x22
Banner 92x44

The capes have different resolutions but the aspect ratio is consistent within themselves. However, the resolution is different from the Minecraft cape images and will definitely require some extra logic to handle that.

I did see the PR #11, but so far I am thinking of implementing the support in a different way, as I am brainstorming a different system that would allow to custom cape support without adding specific logic in the code itself.

Oh, and caching logic might need to be changed as well to account for the capes.

In the following days, I will (hopefully) implement a proper system for custom capes.

NickAcPT avatar Apr 22 '24 16:04 NickAcPT

I think I can change OptifineCape to CustomCape on my PR and provide the option to modify the cape texture url in the configuration file, just like the mojang configuration

To support optifine cape resolution just add a customize resize option or provide a resize mode for optifine cape

killerprojecte avatar Apr 22 '24 22:04 killerprojecte

Reopening this since the issue itself (supporting optifine and other capes) isn't fully implemented yet.

The commit https://github.com/NickAcPT/nmsr-rs/commit/e6210003d422fc4c2b6ff6678c6c08d1c03441f1 introduced a way to render skins with any cape, as long as it matches the expected aspect ratio (2:1), but only for POST requests (these essentially let you have custom skins in general.

NickAcPT avatar May 13 '24 13:05 NickAcPT