Jump to content

Recommended Posts

Posted

Hello,

I have just started modding with Forge in 1.6.2. Before that I was using Modloader. Now when I switched, I, of course, had lots of issues, most of which I have solved. However I cant get my custom armor to work correctly. Before this I didn't even have an ItemArmor.java, I just had everything done in the main mod file. Now, I think I have created an Armor file that will work, but I don't know what I need in my main mod file. If you could help that would be great. Thanks

 

ItemSapphireArmor

 

 

package superninjaman45.elvesanddwarves;

import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;

public class ItemSapphireArmor extends ItemArmor{

public ItemSapphireArmor(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) {
	super(par1, par2EnumArmorMaterial, par3, par4);
}

public String getArmorTextureFile(ItemStack itemstack) {
	if(itemstack.itemID == ElvesAndDwarves.SapHelmet.itemID){
		return "elvesanddwarves:textures/armor/saparmor_layer_1.png";}

	if(itemstack.itemID == ElvesAndDwarves.SapBody.itemID){
		return "elvesanddwarves:textures/armor/saparmor_layer_1.png";}

	if(itemstack.itemID == ElvesAndDwarves.SapBoots.itemID){
		return "elvesanddwarves:textures/armor/saparmor_layer_2.png";}

	if(itemstack.itemID == ElvesAndDwarves.SapPants.itemID){
		return "elvesanddwarves:textures/armor/saparmor_layer_2.png";
		}
	else return null;

	}


}

 

Here is some bits and pieces from my mod file about the armor. (The entire thing is very large and cluttered with other things)

 

 

public static final Item SapBody = (new ItemSapphireArmor(2108, EnumArmorMaterial.DIAMOND ,5,1 ).setUnlocalizedName("spbd").func_111206_d("elvesanddwarves:spbd"));
public static final Item SapHelmet = (new ItemSapphireArmor(2109,EnumArmorMaterial.DIAMOND ,5,0 ).setUnlocalizedName("sphm").func_111206_d("elvesanddwarves:sphm"));
public static final Item SapPants = (new ItemSapphireArmor(2111,EnumArmorMaterial.DIAMOND ,5,2 ).setUnlocalizedName("sppt").func_111206_d("elvesanddwarves:sppt"));
public static final Item SapBoots = (new ItemSapphireArmor(2112,EnumArmorMaterial.DIAMOND, 5, 3 ).setUnlocalizedName("spbt").func_111206_d("elvesanddwarves:spbt"));


@EventHandler
        public void load(FMLInitializationEvent event) {
                proxy.registerRenderers();
         // Sapphire Chest Armor

        				ModLoader.addName(SapBody, "Sapphire Chestplate");
        				ModLoader.addRecipe(new ItemStack(SapBody,1), new Object[]{
        					"* *", "***", "***", Character.valueOf('*'), Sapphire});
        				
        				// Sapphire Helmet Armor

        				ModLoader.addName(SapHelmet, "Sapphire Helmet");
        				ModLoader.addRecipe(new ItemStack(SapHelmet,1), new Object[]{
        					"***", "* *", "   ", Character.valueOf('*'), Sapphire});
        				
        				
        				// Sapphire Pants Armor
        				
        				ModLoader.addName(SapPants, "Sapphire Leggings");
        				ModLoader.addRecipe(new ItemStack(SapPants,1), new Object[]{
        					"***", "* *", "* *", Character.valueOf('*'), Sapphire});
        				
        				// Sapphire Boots Armor

        				ModLoader.addName(SapBoots, "Sapphire Boots");
        				ModLoader.addRecipe(new ItemStack(SapBoots,1), new Object[]{
        					"   ", "* *", "* *", Character.valueOf('*'), Sapphire});
        					
        				ModLoader.addArmor("saparmor"); 
}

 

 

Very sorry if this seems very easy or obvious. I has just been a long time since I have fiddled with the armor. Frankly, I am surprised I got this working in Modloader, I am not sure how the ModLoader.addArmor("saparmor"); got the armor set up correctly as I don't refer to "saparmor" anywhere. Also, sorry for using Modloader in my code.

Thanks for your help.

An average guy who mods Minecraft. If you need help and are willing to use your brain, don't be afraid to ask.

 

Also, check out the Unofficial Minecraft Coder Pack (MCP) Prerelease Center for the latest from the MCP Team!

 

Was I helpful? Leave some karma/thanks! :)

Posted

public String getArmorTextureFile(ItemStack itemstack)

I am pretty sure this method do not exist anymore in 1.6. Change to the following:

public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer)

Posted

Whoops. I had the texture in the wrong folder. Sorry about that. Though for some reason, when my character puts on boots it just makes a bigger pair of leggings. Working on that.

An average guy who mods Minecraft. If you need help and are willing to use your brain, don't be afraid to ask.

 

Also, check out the Unofficial Minecraft Coder Pack (MCP) Prerelease Center for the latest from the MCP Team!

 

Was I helpful? Leave some karma/thanks! :)

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.