Mojira Archive
MC-254341

Skin can be transparent if clients load it as a cape beforehand

How to reproduce:

  1. Set your skin to the migration cape texture (this may be done via the launcher too if you just download the texture and upload it).
     - POST https://api.minecraftservices.com/minecraft/profile/skins
     - body: {"variant":"classic","url":"http://textures.minecraft.net/texture/2340c0e03dd24a11b15a8b33c2a7e9e32abb2051b2481d0ba7defd635ca7a933"}
  2. Join a server where other players are using this cape.
  3. Your skin renders like this for other players:

 

Why this happens (code referenced, 1.18.2, but should not be much different elsewhere):

SkinManager.registerSkins takes in a game profile and both SKIN, and CAPE textures are passed down to registerTexture.

SkinManager.registerTexture will try to grab a cached copy from assets/skins/hash if one is available, regardless of if comes from a skin or a cape.

If the skin is not available, it will create it as an HttpTexture, and it has a flag for processLegacySkin which is set to true if this is being registered as a SKIN, but false for CAPEs.

HttpTexture.load will, if processLegacySkin is set, call to processLegacySkin, which calls setNoAlpha on several parts of the skin, stripping away transparency.

 

The issue here is that, if this same texture has been loaded as a cape first, then no alpha stripping has been applied, and so, when someone else joins with this skin, your client will just re-use the same texture without alpha being stripped, causing this bug.

Fixed

Pablete 1234

[Mojang] Gegy

2022-07-18, 06:38 PM

2024-05-19, 08:31 PM

2022-07-19, 11:27 AM

1

3

Plausible

Important

Rendering

1.19, 1.19.1 Pre-release 5

1.19.1 Pre-release 6