package com.zivilon.cinder_loe.items;

import com.zivilon.cinder_loe.CinderLoE;
import lotr.common.LOTRAchievement;
import lotr.common.LOTRCreativeTabs;
import lotr.common.LOTRLevelData;
import lotr.common.LOTRMod;
import lotr.common.item.LOTRItemFood;
import lotr.common.item.LOTRItemSword;
import lotr.common.item.LOTRMaterial;
import lotr.common.item.LOTRWeaponStats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;

public class CinderItemFood extends LOTRItemFood {

    private int damageAmount;
    public CinderItemFood(int healAmount, float saturation, boolean canWolfEat) {
        super(healAmount, saturation, canWolfEat);
    }

    public CinderItemFood setdamageAmount(int i) {
        this.damageAmount = i;
        return this;
    }
    @Override
    public ItemStack onEaten(ItemStack itemstack, World world, EntityPlayer entityplayer) {
        if (!world.isRemote && this == LOTRMod.maggotyBread) {
            LOTRLevelData.getData(entityplayer).addAchievement(LOTRAchievement.eatMaggotyBread);
        }
        if (this.damageAmount > 0) {
            entityplayer.attackEntityFrom(DamageSource.onFire, (float)this.damageAmount);
        }
        return super.onEaten(itemstack, world, entityplayer);
    }
}