Jump to content

[1.7.10][SOLVED!] Armor not working!


MrJPGames

Recommended Posts

Ok, so as of recentry I started updating this mod I made about 1 1/2 years ago. It took quite a bit of time but I am incapable of making the armor function. It renders correctly but the little armor icons above the health only show 1 armor piece and only from the helmet!

 

The Material:

public static ArmorMaterial armorOBSIDIAN = EnumHelperClient.addArmorMaterial("OBSIDIAN",66, new int[]{3, 8, 6, 3}, 30);

 

The items in mod file:

public static final Item helmetObsidian = (new MT_ItemArmor(armorOBSIDIAN, 0, helmetOID)).setUnlocalizedName("helmetObsidian");
    public static final Item plateObsidian = (new MT_ItemArmor(armorOBSIDIAN, 1, chestplateOID)).setUnlocalizedName("chestplateObsidian");
    public static final Item legsObsidian = (new MT_ItemArmor(armorOBSIDIAN, 2, legsOID)).setUnlocalizedName("leggingsObsidian");
    public static final Item bootsObsidian = (new MT_ItemArmor(armorOBSIDIAN, 3, bootsOID)).setUnlocalizedName("bootsObsidian");
    

 

MT_ItemArmor:

package MoreTools;

import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;

public class MT_ItemArmor extends ItemArmor{

public MT_ItemArmor(ArmorMaterial material, int placement, int id) {
	super(MT_mod.armorCOPPER, id, placement);
	setCreativeTab(CreativeTabs.tabCombat);
}

public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type){
	if (stack.getItem() == MT_mod.helmetCopper || stack.getItem() == MT_mod.plateCopper || stack.getItem() == MT_mod.bootsCopper){
		return "moretools:textures/models/armor/Copper_1.png";
	}
	if (stack.getItem() == MT_mod.legsCopper){
		return "moretools:textures/models/armor/Copper_2.png";
	}
	if (stack.getItem() == MT_mod.helmetEmerald || stack.getItem() == MT_mod.plateEmerald || stack.getItem() == MT_mod.bootEmerald){
		return "moretools:textures/models/armor/Emerald_1.png";
	}
	if (stack.getItem() == MT_mod.legsEmerald){
		return "moretools:textures/models/armor/Emerald_2.png";
	}
	if (stack.getItem() == MT_mod.helmetNetherDiamond || stack.getItem() == MT_mod.plateNetherDiamond || stack.getItem() == MT_mod.bootNetherDiamond){
		return "moretools:textures/models/armor/NetherDiamond_1.png";
	}
	if (stack.getItem() == MT_mod.legsNetherDiamond){
		return "moretools:textures/models/armor/NetherDiamond_2.png";
	}
	if (stack.getItem() == MT_mod.helmetObsidian || stack.getItem() == MT_mod.plateObsidian || stack.getItem() == MT_mod.bootsObsidian){
		return "moretools:textures/models/armor/Obsidian_1.png";
	}
	if (stack.getItem() == MT_mod.legsObsidian){
		return "moretools:textures/models/armor/Obsidian_2.png";
	}
	if (stack.getItem() == MT_mod.helmetRuby || stack.getItem() == MT_mod.plateRuby || stack.getItem() == MT_mod.bootsRuby){
		return "moretools:textures/models/armor/Ruby_1.png";
	}
	if (stack.getItem() == MT_mod.legsRuby){
		return "moretools:textures/models/armor/Ruby_2.png";
	}
	if (stack.getItem() == MT_mod.helmetSandstone || stack.getItem() == MT_mod.plateSandstone || stack.getItem() == MT_mod.bootSandstone){
		return "moretools:textures/models/armor/Sandstone_1.png";
	}
	if (stack.getItem() == MT_mod.legsSandstone){
		return "moretools:textures/models/armor/Sandstone_2.png";
	}
	if (stack.getItem() == MT_mod.helmetSapphire || stack.getItem() == MT_mod.plateSapphire || stack.getItem() == MT_mod.bootSapphire){
		return "moretools:textures/models/armor/Sapphire_1.png";
	}
	if (stack.getItem() == MT_mod.legsSapphire){
		return "moretools:textures/models/armor/Sapphire_2.png";
	}
	if (stack.getItem() == MT_mod.helmetSteel || stack.getItem() == MT_mod.plateSteel || stack.getItem() == MT_mod.bootsSteel){
		return "moretools:textures/models/armor/Steel_1.png";
	}
	if (stack.getItem() == MT_mod.legsSteel){
		return "moretools:textures/models/armor/Steel_2.png";
	}
	return null;
}
@Override
    public void registerIcons(IIconRegister par1IconRegister)
    {
    	this.itemIcon = par1IconRegister.registerIcon("moretools:" + this.getUnlocalizedName().substring(5));
    }
}

 

Does someone know how to make the armor function properly?!

I try not to be mean about your english (as my own isn't the best either) but sometimes I can't help myself!

If you get mad at me for this or any other reason, please look at the profile picture so you'll feel better (and pretier) than me!

Thanks.

Link to comment
Share on other sites

Thanks for the fast reply, and yes I could make the code simpler but I was only updating (from 1.4.7) to 1.7.10 to play with some friends somewhere next week so I probably will make it work however dirty the code (I didn't do a great job with clean code 1.5 years ago!).

 

So I changed the Enum code slightly (now uses EnumHelper instead of EnumHelperClient). But it still doesn't work! Here is the code:

static ArmorMaterial armorOBSIDIAN = EnumHelper.addArmorMaterial("OBSIDIAN",66, new int[]{3, 8, 6, 3}, 30);

 

Which doesn't look/function much diffrent from your (as far as i can see):

armorMaterialIMC = EnumHelper.addArmorMaterial("IMC", 33, new int[]{3, 8, 6, 3}, 10);

 

Yet it still doesn't work properly. I couldn't find any other causes (though maybe I'm just missing them). If you/anyone else needs another more code I would love to suply those. Direct help would be empriciated. FYI I'm curently using MCF : 1.7.10-10.13.0.1179

I try not to be mean about your english (as my own isn't the best either) but sometimes I can't help myself!

If you get mad at me for this or any other reason, please look at the profile picture so you'll feel better (and pretier) than me!

Thanks.

Link to comment
Share on other sites

Does anyone know what I am doing wrong, it's the only thing I can't get working. At this point it seems to me like I have tried evrything but I'm sure that I'm missing something!

 

As said before if you need more code I will obvs give that code as soons as I can!

I try not to be mean about your english (as my own isn't the best either) but sometimes I can't help myself!

If you get mad at me for this or any other reason, please look at the profile picture so you'll feel better (and pretier) than me!

Thanks.

Link to comment
Share on other sites

Is it just the armor bar rendering, or does the armor not function? If it's just the bar, you can try implementing ISpecialArmor to customize it.

 

I think that ISpecialArmor should be able to fix it. The armor seems to function as it should it's just the armor bar. After implementing ISpecialArmor I get 3 functions I haven't used before. The bar doesn't show at all (first it only showed with the helmet and incorectly) I think it has to do with everything returning null, or 0 but as I don't know what they should return I can't fix it.

 

The three functions are:

ArmorProperties, getArmorDisplay and damageArmor

 

I think getArmorDisplay should be it so now I would like to know how to implemt this (along side the other one as they make the original function of the armor not work as I have yet to test this after the changes!)

I try not to be mean about your english (as my own isn't the best either) but sometimes I can't help myself!

If you get mad at me for this or any other reason, please look at the profile picture so you'll feel better (and pretier) than me!

Thanks.

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.