package com.cheesel0ver.items.raki;

import com.cheesel0ver.main.mainRegistry;

import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;

public class rakiArmor extends ItemArmor{
	public rakiArmor(ArmorMaterial armorMaterial, int renderIndex, int armourType){
		super(armorMaterial, renderIndex, armourType);
	}
	
	@Override
	public String getArmorTexture(ItemStack stack, Entity entity, int slot, String layer){
		if(stack.getItem().equals(RakiItems.helmetRaki)|| stack.getItem().equals(RakiItems.chestplateRaki)|| stack.getItem().equals(RakiItems.bootsRaki)){
			return "raki:textures/armor/raki_1.png";
		}
		
		if(stack.getItem().equals(RakiItems.legsRaki)){
			return "raki:textures/armor/raki_2.png";
		}
		
		else return null;
	}
	
	@Override
	public void registerIcons(IIconRegister reg){
		if(this == RakiItems.helmetRaki)
			this.itemIcon = reg.registerIcon("raki:helmetRaki");
		if(this == RakiItems.chestplateRaki)
			this.itemIcon = reg.registerIcon("raki:chestplateRaki");
		if(this == RakiItems.legsRaki)
			this.itemIcon = reg.registerIcon("raki:legsRaki");
		if(this == RakiItems.bootsRaki)
			this.itemIcon = reg.registerIcon("raki:bootsRaki");
	}
	
	@Override
	public void onArmorTick(World world, EntityPlayer player, ItemStack stack){
		if(stack.getItem() == RakiItems.bootsRaki){
			int j = EnchantmentHelper.getEnchantmentLevel(mainRegistry.speedBoost.effectId, stack);
			if(j > 0){
				player.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 50, j - 1));
			}
		}
	}
	
}