package com.zivilon.cinder_loe.mixins;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.At;
import lotr.common.item.LOTRWeaponStats;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantment;
import lotr.common.enchant.LOTREnchantmentHelper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.play.server.S2BPacketChangeGameState;
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.World;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import java.util.List;
import net.minecraft.entity.monster.EntityEnderman;

@Mixin(EntityLiving.class)
public abstract class MixinEntityLiving extends Entity {
    @Shadow
    private boolean getLeashed(){return false;};

    public MixinEntityLiving(World world) {
        super(world);
    }

    /**
     * @author MrJeep20
     * @reason Made ridden entities unleashable
     */
    @Overwrite
    public boolean allowLeashing() {
        if(this.riddenByEntity != null) {
            return false;
        }
        return !this.getLeashed() && !(this instanceof IMob);
    }
}
