Search in sources :

Example 1 with AbstractSkeleton

use of net.minecraft.entity.monster.AbstractSkeleton in project NetherEx by LogicTechCorp.

the class EventHandler method onLivingDeath.

@SubscribeEvent
public static void onLivingDeath(LivingDeathEvent event) {
    Entity entity = event.getEntity();
    World world = entity.getEntityWorld();
    BlockPos pos = entity.getPosition();
    DamageSource source = event.getSource();
    if (entity instanceof AbstractSkeleton) {
        if (source.getSourceOfDamage() instanceof EntityPlayer) {
            EntityPlayer player = (EntityPlayer) source.getSourceOfDamage();
            if (ArmorUtil.isWearingFullArmorSet(player, NetherExMaterials.ARMOR_BONE_WITHERED)) {
                player.addStat(NetherExAchievements.FROM_WITHIN);
            }
        }
    }
}
Also used : Entity(net.minecraft.entity.Entity) AbstractSkeleton(net.minecraft.entity.monster.AbstractSkeleton) DamageSource(net.minecraft.util.DamageSource) EntityPlayer(net.minecraft.entity.player.EntityPlayer) BlockPos(net.minecraft.util.math.BlockPos) World(net.minecraft.world.World) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 2 with AbstractSkeleton

use of net.minecraft.entity.monster.AbstractSkeleton in project NetherEx by LogicTechCorp.

the class EventHandler method onSetAttackTarget.

@SubscribeEvent
public static void onSetAttackTarget(LivingSetAttackTargetEvent event) {
    EntityLivingBase attacker = (EntityLivingBase) event.getEntity();
    EntityLivingBase attackee = event.getTarget();
    if (attackee instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) attackee;
        if (attacker instanceof AbstractSkeleton) {
            if (ArmorUtil.isWearingFullArmorSet(player, NetherExMaterials.ARMOR_BONE_WITHERED)) {
                ((AbstractSkeleton) attacker).setAttackTarget(null);
                player.addStat(NetherExAchievements.IN_PLAIN_SIGHT);
            }
        }
        if (attacker instanceof EntityPigZombie) {
            player.addStat(NetherExAchievements.UH_OH);
        }
        if (attacker instanceof EntityMogus) {
            player.addStat(NetherExAchievements.CUTE_BUT_DEADLY);
        }
    }
}
Also used : AbstractSkeleton(net.minecraft.entity.monster.AbstractSkeleton) EntityPigZombie(net.minecraft.entity.monster.EntityPigZombie) EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer) EntityMogus(nex.entity.neutral.EntityMogus) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

AbstractSkeleton (net.minecraft.entity.monster.AbstractSkeleton)2 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 Entity (net.minecraft.entity.Entity)1 EntityLivingBase (net.minecraft.entity.EntityLivingBase)1 EntityPigZombie (net.minecraft.entity.monster.EntityPigZombie)1 DamageSource (net.minecraft.util.DamageSource)1 BlockPos (net.minecraft.util.math.BlockPos)1 World (net.minecraft.world.World)1 EntityMogus (nex.entity.neutral.EntityMogus)1