Jump to content

Recommended Posts

Posted

Your item class just has to implement ISpecialArmor like this:

....

public class YourArmor implements ISpecialArmor

{

... your methods

  public void damageArmor(EntityLiving entity, ItemStack stack, DamageSource source, int damage, int slot){}

... anything else

}

 

and done. your armor should now not take damage anymore

Posted

package JerryMod;

 

import java.util.List;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.entity.EntityLiving;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.EnumArmorMaterial;

import net.minecraft.item.ItemArmor;

import net.minecraft.item.ItemStack;

import net.minecraft.util.DamageSource;

import net.minecraft.util.StringTranslate;

import net.minecraftforge.common.IArmorTextureProvider;

import net.minecraftforge.common.ISpecialArmor;

 

public class JerrysArmor extends ItemArmor implements ISpecialArmor {

 

public JerrysArmor(int par1, EnumArmorMaterial par2EnumArmorMaterial,

int par3, int par4) {

super(par1, par2EnumArmorMaterial, par3, par4);

this.setCreativeTab(JerrysMod.CreativeTab);

}

 

public String getArmorTextureFile(ItemStack itemstack) {

if(itemstack.itemID == JerrysMod.SlimeHelmet.itemID || itemstack.itemID == JerrysMod.SlimeChestplate.itemID){

return "/mods/jerrymod/textures/armor/Slime_1.png";

}

 

if(itemstack.itemID == JerrysMod.SlimeBoots.itemID){

return "/mods/jerrymod/textures/armor/Slime_2.png";

}

 

if(itemstack.itemID == JerrysMod.SlimeLeggings.itemID){

return "/mods/jerrymod/textures/armor/Slime_2.png";

}

else return null;

}

 

  public String getItemDisplayName(ItemStack par1ItemStack)

  {

  String var2 = ("\u00a7a" + StringTranslate.getInstance().translateNamedKey(this.getLocalizedName(par1ItemStack))).trim();

  return var2;

  }

@SideOnly(Side.CLIENT)

public void damageArmor(EntityLiving entity, ItemStack stack, DamageSource source, int damage, int slot){}

public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean i)

{

list.add("Infinite Durability");

 

}

}

=================================================

public class JerrysArmor extends ItemArmor implements ISpecialArmor {

The  JerrysArmor is giving me an error? any help?

Posted

package JerryMod;

 

import java.util.List;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.entity.EntityLiving;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.EnumArmorMaterial;

import net.minecraft.item.ItemArmor;

import net.minecraft.item.ItemStack;

import net.minecraft.util.DamageSource;

import net.minecraft.util.StringTranslate;

import net.minecraftforge.common.IArmorTextureProvider;

import net.minecraftforge.common.ISpecialArmor;

 

public class JerrysArmor extends ItemArmor implements ISpecialArmor {

 

public JerrysArmor(int par1, EnumArmorMaterial par2EnumArmorMaterial,

int par3, int par4) {

super(par1, par2EnumArmorMaterial, par3, par4);

this.setCreativeTab(JerrysMod.CreativeTab);

}

 

public String getArmorTextureFile(ItemStack itemstack) {

if(itemstack.itemID == JerrysMod.SlimeHelmet.itemID || itemstack.itemID == JerrysMod.SlimeChestplate.itemID){

return "/mods/jerrymod/textures/armor/Slime_1.png";

}

 

if(itemstack.itemID == JerrysMod.SlimeBoots.itemID){

return "/mods/jerrymod/textures/armor/Slime_2.png";

}

 

if(itemstack.itemID == JerrysMod.SlimeLeggings.itemID){

return "/mods/jerrymod/textures/armor/Slime_2.png";

}

else return null;

}

 

  public String getItemDisplayName(ItemStack par1ItemStack)

  {

  String var2 = ("\u00a7a" + StringTranslate.getInstance().translateNamedKey(this.getLocalizedName(par1ItemStack))).trim();

  return var2;

  }

@SideOnly(Side.CLIENT)

public void damageArmor(EntityLiving entity, ItemStack stack, DamageSource source, int damage, int slot){}

public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean i)

{

list.add("Infinite Durability");

 

}

}

=================================================

public class JerrysArmor extends ItemArmor implements ISpecialArmor {

The  JerrysArmor is giving me an error? any help?

 

What error?

I assume your class name (public class JerrysArmor) is not equal to the java filename (in this case it must be named like "JerrysArmor.java"). Also those names are case-sensitive!

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

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.