package com.zivilon.cinder_loe.items;

import com.zivilon.cinder_loe.LoECreativeTabs;

import java.util.ArrayList;
import java.util.List;

import lotr.common.LOTRBannerProtection;
import lotr.common.LOTRMod;
import lotr.common.enchant.LOTREnchantment;
import lotr.common.enchant.LOTREnchantmentHelper;
import lotr.common.item.LOTRItemSword;
import lotr.common.item.LOTRMaterial;
import lotr.common.item.LOTRWeaponStats;

import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public class Whip extends LOTRItemSword {
    public Whip() {
        super(LOTRMaterial.FUR);
        this.setCreativeTab(LoECreativeTabs.tabCombatLoE);
        this.lotrWeaponDamage = 4.0F;
        LOTRWeaponStats.registerMeleeReach(Whip.class, 1.5F);
    }

    public boolean func_77644_a(ItemStack itemstack, EntityLivingBase hitEntity, EntityLivingBase user) {
        super.hitEntity(itemstack, hitEntity, user);
        launchWhip(user, hitEntity);
        return true;
    }

    public EnumAction getItemUseAction(ItemStack itemstack) {
        return EnumAction.none;
    }

    private void launchWhip(EntityLivingBase user, EntityLivingBase hitEntity) {
        World world = ((Entity)user).worldObj;
        world.playSoundAtEntity((Entity)user, "lotr:item.balrogWhip", 2.0F, 0.7F + Item.itemRand.nextFloat() * 0.6F);
    }

    public boolean getIsRepairable(ItemStack itemstack, ItemStack repairItem) {
        return (repairItem.getItem() == Items.leather);
    }

    private void checkIncompatibleModifiers(ItemStack itemstack) {}
}
