Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.8] [UNSOLVED] Creating wearable armor?

Recommended Posts


I was wondering how to create an Item so that it can be used as a piece of wearable armor.

Here is my armor class:

package uc.armor;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraftforge.common.ISpecialArmor.ArmorProperties;
import uc.mainmod.UltraCraft;

public class EmeraldArmor extends ItemArmor {
public EmeraldArmor(ArmorMaterial p_i45325_1_, int p_i45325_2_,
		int p_i45325_3_) {
	super(p_i45325_1_, p_i45325_2_, p_i45325_3_);

public ArmorProperties getProperties(EntityLivingBase player,
		ItemStack armor, DamageSource source, double damage, int slot) {
	return new ArmorProperties(0, 0, 0);

public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
	return 4;

public void damageArmor(EntityLivingBase entity, ItemStack stack,
		DamageSource source, int damage, int slot) {
	stack.damageItem(damage * 2, entity);

public String getArmorTexture(ItemStack armor, Entity entity, int slot,
		String type) {
	if (armor.getItem() == UltraCraft.emeraldLeggings) {
		return "UltraCraft:textures/armor/emerald_layer_2.png";
	} else {
		return "UltraCraft:textures/armor/emerald_layer_1.png";

public CreativeTabs[] getCreativeTabs() {
	return new CreativeTabs[] { CreativeTabs.tabCombat };

public boolean getIsRepairable(ItemStack armor, ItemStack stack) {
	return stack.getItem() == Items.emerald;


I also have:

public static Item emeraldHelmet;
public static Item emeraldChestplate;
public static Item emeraldLeggings;
public static Item emeraldBoots;


But how do I make those items pieces of wearable armor?

Sup bruh.

Link to post
Share on other sites

Also, where do I call the constructor for EmeraldArmor? What should I give for its parameters?


It's a fucking item.  Call its constructor the same place and the same time as you call the constructors for all your other items.


And its parameter types are clearly listed, especially if you follow the super constructor and actually LOOK at ItemArmor.  ArmorMaterial, armorType (what slot it goes in), and renderID.



You will need to define a new ArmorMaterial.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.


Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.


DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to post
Share on other sites

public class EmeraldArmor extends ItemArmor {
public addarmor(String name, int index, int type) {
	super(yourmainclass.ArmorMaterial_EMERALD, index, type);

	GameRegistry.registerItem(this, name);

public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
	if (slot == 2) {
		return yourmodid + ":textures/models/armor/emerald_layer_2.png";
	} else {
		return yourmodid + ":textures/models/armor/emerald_layer_1.png";



To the main code:

	public static ArmorMaterial ArmorMaterial_EMERALD = EnumHelper.addArmorMaterial("EMERALD", "emerald", 44, new int[] {4, 10, 8, 4}, 15);



[/size]When you register;


	emeraldHelmet = new EmeraldArmor("emeraldhelmet", 4, 0);

	emeraldChestplate = new EmeraldArmor("emeraldchestplate",  4, 1);

	emeraldLeggings = new EmeraldArmor("emeraldleggings", 4, 2);

	emeraldBoots = new EmeraldArmor("emeraldboots", 4, 3);



Put your emerald models to;

\src\main\resources\assets\your modid\textures\models\armor




You need to register item textures with modelregistry.

Link to post
Share on other sites

1. You can't super() if the method you're using isn't the constructor, and that would be the incorrect constructor parameters.

2. Where is


ran? Does the game run it itself, like an init method? Or do I need to call it myself?

3: What should an armor .json file look like?

Sup bruh.

Link to post
Share on other sites

I'm a bit new to all of this, so I may butcher exact language pretty badly here.  (I appreciate being corrected by knowers.)  Thus I go!


1.  I believe the super() method you're referring to is defining the constructor used in the extended ItemArmor java.  This is why you're required to define it in your custom Armor class perhaps exactly like xwerswoodx has done.  If you're using Eclipse, you can hold Ctrl, mouse over super and click Open Implementation.  It will show you why this needs to be defined in your custom Armor.


2.  The getArmorTexture is a process (or function if you will) that is provided in the ItemArmor java as well.  If you're using Eclipse, you can hold Ctrl, mouse over getArmorTexture and click Open Super Implementation.  It will open the ItemArmor java file and direct you straight to this function- this is why we're able to utilize it in your custom class.  You will deal with your Armor items in your Mod's Item's class perhaps entirely like this...


public class YourModItems
public static Item mithril_helmet;
public static Item mithril_chestplate;
public static Item mithril_boots;
public static Item mithril_leggings;

public static final ItemArmor.ArmorMaterial mithrilArmorMaterial = EnumHelper.addArmorMaterial("mithirlArmorMaterial", "mithrilArmorMaterial", 3000, new int[]{4,10,7,5}, 30);

public static void init()
	mithril_helmet = new ItemMithrilArmor(mithrilArmorMaterial, 0, 0).setUnlocalizedName("mithril_helmet").setCreativeTab(SupercraftMod.tabSupercraft);
	mithril_chestplate = new ItemMithrilArmor(mithrilArmorMaterial, 0, 1).setUnlocalizedName("mithril_chestplate").setCreativeTab(SupercraftMod.tabSupercraft);
	mithril_leggings = new ItemMithrilArmor(mithrilArmorMaterial, 0, 2).setUnlocalizedName("mithril_leggings").setCreativeTab(SupercraftMod.tabSupercraft);
	mithril_boots =	new ItemMithrilArmor(mithrilArmorMaterial, 0, 3).setUnlocalizedName("mithril_boots").setCreativeTab(SupercraftMod.tabSupercraft);

public static void register()
	GameRegistry.registerItem(mithril_helmet, mithril_helmet.getUnlocalizedName().substring(5));
	GameRegistry.registerItem(mithril_chestplate, mithril_chestplate.getUnlocalizedName().substring(5));
	GameRegistry.registerItem(mithril_leggings, mithril_leggings.getUnlocalizedName().substring(5));
	GameRegistry.registerItem(mithril_boots, mithril_boots.getUnlocalizedName().substring(5));

public static void registerRenders()

public static void registerRender(Item item)
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));


3.  Tip: Get into the habit of scouring the code yourself because easy questions like this can put some people out.  The trick is, of course, knowing when something is simple and when it might require some help ;).  For example, what a typical json file looks like is easy to discover by opening your forge minecraft assets folder.  My directory is: forgeSrc-yourVersion/assets/minecraft/models/item/ this would be the directory you would look to find json files for typical items like armor.  Json files are stored in the forgeSrc-yourVersion/assets/minecraft/models directory.  In the item folder, open material_helmet.json, copy that code into a new text file, and save it appropriately.


If this is still confusing for you, search on YouTube for Mr. Crayfish's 1.7 modding series- episode 12 deals with armor and he steps you through things.


Hope this resolves your issues.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Whenever i try to run the installer it says This application requires a java runtime environment 1.6.0 im runing windows 10
    • So I thought that I had gotten pretty far on my own but now apparently my code crashes the game. I am new to using the forge API and modding in general and some help on why this crashes the game and how to fix it would be greatly appreciated:   public class SpecialItem extends ShootableItem {      public SpecialItem(Properties properties){ super(properties); }      @Override      public Predicate<ItemStack> getInventoryAmmoPredicate() { return null; }      @Override      public int func_230305_d_() { return 15; }      public int tcount=0;      @SubscribeEvent public void ontick(TickEvent.ClientTickEvent event){            tcount++;      }      @Override      public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {      if (!playerIn.getCooldownTracker().hasCooldown(this)) {           playerIn.getCooldownTracker().setCooldown(this, 40);           Vector3d v3 = playerIn.getLook(1);           for (tcount = 0; tcount <= 40;) {                if (tcount%10 == 0 && tcount!= 40) {                     final SmallFireballEntity entitysmallfireball = new SmallFireballEntity(playerIn.getEntityWorld(), playerIn.getPosX(), playerIn.getPosY() + playerIn.getEyeHeight() - 0.4, playerIn.getPosZ(), v3.x + playerIn.getRNG().nextGaussian() * 0.05, v3.y, v3.z);                     entitysmallfireball./* shoot */func_234612_a_(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0f, 1.5f, 1.0f); worldIn.addEntity(entitysmallfireball); } } tcount = 0;                     return ActionResult.resultSuccess(playerIn.getHeldItem(handIn));            } return ActionResult.resultFail(playerIn.getHeldItem(handIn));      } }
    • I found a way to handle this, using javapoet as you suggested. For those who are interested in how it works, you can take a look at my sample here: https://github.com/DarkShadow44/compatibilitymod/tree/sourcegen Might not work with eclipse yet, but it builds properly.
    • It's fired on the logical client and logical server. Most likely you'll only need to execute the logic on the server.
    • If you're translating individual files, there's not much you can do about it. You could use the updateMappings gradlew task, but that's better for large batches of code. As for JSON item models, that is a much more complicated issue that involves layers and custom transform types. While still possible, the tradeoff isn't really worth it.
  • Topics

  • Who's Online (See full list)

  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.