Armor – Architectury API Multiplatform Modding

After we have added Tools and Swords to the game in the last part, this time we add Armor to Minecraft. Similar to tools we also need to first define an armor material for our armor. A major difference however lies in the rendering of the armor when worn.

Additional Resources

The Tutorial Mod used here can be found on GitHub (state after this tutorial).
A video version can be found below.

Contents

  1. Armor Material
  2. Armor Items
  3. Special Resources
  4. Ingame
  5. Video

Armor Material

The first thing we need to add is the armor material for our armor. It specifies the properties of our armor like durability or damage resistance. But before we can add the material we need to define two required properties: The repair item tag and the armor material key. The tag for our repair items is defined similar to the one used for tools:

Furthermore we need to create an armor material key. It tells the game where to lookup the textures for the armor when worn. We create this key in the following way:

The second parameter in the ResourceLocation defined here specifies the file name, which we need later. Now we can create our armor material:

The durability defines a factor with which the base durability for each armor type is multiplied. See the wiki for more information on this. Next we specify the damage resistance of the different armor parts as a map. Following this are the enchantability (how well an item can be enchanted) and the sound played when the armor is put on through right-clicking with a piece in the hand. Next we define the armor toughness and knockback resistance. Finally we add our repair item tag and the material key created earlier to our armor material.

Armor Items

Now that we have a material for our armor, it’s time to add the items themselves. For our Ruby Helmet for example, the code would look like this:

In contrast to tools, armor items all share the same class (ArmorItem) and are differentiated by the armor type given to them. You need to replace the bold HELMET with the respective item type for the other armor parts. Furthermore we need to add two sets of resources to our item. The first is for the item as shown in the inventory. The steps for this are identical to regular items, so I’ll not show them here again. The second set contains the resources for the worn armor. Also remember not to forget adding your item to the repair items tag. Check out the guide on tools to see how this is done.

Special Resources

As explained above we need to tell the game where to find the textures for our worn armor. For this you need to create a file with the name specified in your armor material key at the path resources/assets/tutorial_mod/equipment/ruby.json:

In this file we specify the textures for the different possible armor layers. For our regular armor we need two layers: The upper body (humanoid) and the legs of the player (humanoid_leggings). We specify the texture to use in the respective blocks. We need to place the accordingly named .png-Files at resources/assets/tutorial_mod/textures/entity/equipment/humanoid/ruby.png and resources/assets/tutorial_mod/textures/entity/equipment/humanoid_leggings/ruby.png respectively.

Ingame

With that we have added our armor pieces and can jump into the game to see how they look:

Armor shown worn in the game
Armor shown worn in the inventory preview
Armor stats shown in the inventory

That concludes the relevant basic things, in the next parts I’ll explain some more advanced topics related to blocks, starting with rotatable blocks like furnaces and pistons.

Video

Please accept YouTube cookies to play this video. By accepting you will be accessing content from YouTube, a service provided by an external third party.

YouTube privacy policy

If you accept this notice, your choice will be saved and the page will refresh.

Related Content

Check out the entire series here.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top