Example usage for net.minecraftforge.event.entity.living LivingSetAttackTargetEvent getEntityLiving

List of usage examples for net.minecraftforge.event.entity.living LivingSetAttackTargetEvent getEntityLiving

Introduction

In this page you can find the example usage for net.minecraftforge.event.entity.living LivingSetAttackTargetEvent getEntityLiving.

Prototype

public LivingEntity getEntityLiving() 

Source Link

Usage

From source file:hellfirepvp.astralsorcery.common.event.listener.EventHandlerEntity.java

License:Open Source License

@SubscribeEvent
public void onTarget(LivingSetAttackTargetEvent event) {
    EntityLivingBase living = event.getTarget();
    if (living != null && !living.isDead && living instanceof EntityPlayer) {
        if (invulnerabilityCooldown.contains((EntityPlayer) living)) {
            event.getEntityLiving().setRevengeTarget(null);
            if (event.getEntityLiving() instanceof EntityLiving) {
                ((EntityLiving) event.getEntityLiving()).setAttackTarget(null);
            }// w  w  w. j av a  2  s .c  om
        }
    }
}