Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package halocraft;
- import net.minecraft.creativetab.CreativeTabs;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemArmor;
- import net.minecraft.item.ItemArmor.ArmorMaterial;
- import net.minecraft.item.ItemStack;
- import net.minecraft.util.DamageSource;
- import net.minecraft.util.MathHelper;
- import net.minecraftforge.common.ISpecialArmor;
- import net.minecraftforge.common.ISpecialArmor.ArmorProperties;
- public class HaloArmor extends ItemArmor implements ISpecialArmor {
- public HaloArmor(ArmorMaterial p_i45325_1_, int p_i45325_2_, int p_i45325_3_) {
- super(p_i45325_1_, p_i45325_2_, p_i45325_3_);
- }
- //This is the MOST important method in this class! This gets called every time a player wearing your armor gets damaged, however it is called before the damage is applied so you can modify it.
- public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) {
- if(source == source.inFire || source == source.lava || source == source.onFire) { //Check for fire damage, you can use other types of damage too.
- return new ArmorProperties(1, 1, MathHelper.floor_double(damage * .25D));
- }
- return new ArmorProperties(0, 0, 0);
- }
- public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
- return 20; //How many half shields each piece of armor will fill up on the armor bar
- }
- public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {
- stack.damageItem(damage * 1, entity); //Allows you to control the amount of damage done to each piece of armor, useful for nerfing some suits of armor.
- }
- @Override //This is pretty self explanatory
- public String getArmorTexture(ItemStack armor, Entity entity, int slot, String type) {
- if(armor.getItem() == halocraft.Main.SpartanHelmet) {
- return "halocraft:textures/armor/SpartanHelmet";
- }
- else if(armor.getItem() == halocraft.Main.SpartanChestplate) {
- return "halocraft:textures/armor/SpartanChestplate.png";
- }
- else if(armor.getItem() == halocraft.Main.SpartanLeggings){
- return "halocraft:textures/armor/SpartanLeggings";
- }
- else{
- return "halocraft:textures/armor/SpartanBoots";
- }
- }
- public CreativeTabs[] getCreativeTabs() {
- return new CreativeTabs[] {CreativeTabs.tabCombat}; //This lets me put my armor in as many create tabs as I want, pretty cool right?
- }
- public boolean getIsRepairable(ItemStack armor, ItemStack stack) {
- return stack.getItem() == halocraft.Main.HaloIngot; //Allows certain items to repair this armor.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement