package com.zivilon.cinder_loe.mixins;

import com.zivilon.cinder_loe.CinderLoE;
import lotr.common.LOTRMod;
import lotr.common.entity.animal.LOTREntityBear;
import lotr.common.item.LOTRItemLionRug;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;


@Mixin(LOTREntityBear.class)
public abstract class MixinLOTREntityLioness extends Entity {

    public MixinLOTREntityLioness(World worldIn) {
        super(worldIn);
    }

    protected LOTRItemLionRug.LionRugType getLionRugType() {
        return LOTRItemLionRug.LionRugType.LIONESS;
    }

    /**
     * @author KeyLime17
     * @reason Lions now drop lion fur
     */
    @Overwrite(remap = false)
    protected void func_70628_a(boolean flag, int i) {
        Item furItem = CinderLoE.cinderFurItem;
        int furMeta = 6;

        int furs = 1 + this.rand.nextInt(3) + this.rand.nextInt(i + 1);
        for (int l = 0; l < furs; l++)
            entityDropItem(new ItemStack(furItem, 1, furMeta), 0.0F);
        if (flag) {
            int rugChance = 50 - i * 8;
            rugChance = Math.max(rugChance, 1);
            if (this.rand.nextInt(rugChance) == 0)
                entityDropItem(new ItemStack(LOTRMod.lionRug, 1, (getLionRugType()).lionID), 0.0F);
        }
    }
}
