mojira.dev
MC-268168

Chainmail armor texture broken due to armor material renaming

If you wear chainmail, the texture will break.

Code analysis and fix by @unknown can be found in this comment.

Linked issues

Attachments

Comments 5

Can you run the /data command on the zombies with the incorrect textures and provide a screenshot of the output. To run the command look at the entity and do /data get entity [uuid]

Wearing chainmail causes broken textures

This issue is occuring because the chainmail armor material was renamed to 'chain', when it was previously 'chainmail'. Now, the game is trying to find a texture that doesn't exist.

Code Analysis:

Here where the chain armor material is named, we can see that it is named 'chain', which is different to the file name, which uses 'chainmail' for the prefix.

Class: ArmorMaterials.java
--- ISSUE START ---
      CHAIN = register("chain", Util.make(new EnumMap(ArmorItem.Type.class), (enumMap) -> {
--- ISSUE END ---
         enumMap.put(ArmorItem.Type.BOOTS, 1);
         enumMap.put(ArmorItem.Type.LEGGINGS, 4);
         enumMap.put(ArmorItem.Type.CHESTPLATE, 5);
         enumMap.put(ArmorItem.Type.HELMET, 2);
         enumMap.put(ArmorItem.Type.BODY, 4);
      }), 12, SoundEvents.ARMOR_EQUIP_CHAIN, 0.0F, 0.0F, () -> {
         return Ingredient.of(Items.IRON_INGOT);
      });

Currently used textures:

[media]

Additionally, here is a brief snippit of the code which gets the texture for rendering:
'assetNamePath' is returning 'chain' for chainmail armor.

Class: ArmorMaterials.java
private ResourceLocation resolveTexture(boolean layer) {
         return this.assetName.withPath((path) -> {
            String assetNamePath = this.assetName.getPath();
--- ISSUE START ---
            return "textures/models/armor/" + assetNamePath + "_layer_" + (layer ? 2 : 1) + this.suffix + ".png";
--- ISSUE END ---
         });
      }

Fix:

Assuming 'chain' is the intended name for the armor material seeing as it was a seemingly intentional change, the files simply need to be renamed from 'chainmail' -> 'chain', or vise-versa in the code.

(Possible fix):

[media]

[media]

Hello! I reported this problem too. It looks like the only way to fix is resource packs or old versions. Hopefully it gets fixed soon! Thank you!
-KingKaosUnkged

Alex_light

gegy

Confirmed

Platform

Very Important

Textures and models

24w05a

24w05b

Retrieved