Search in sources :

Example 6 with ISkillCapability

use of jackiecrazy.wardance.capability.skill.ISkillCapability in project WarDance by Jackiecrazy.

the class SkillEventHandler method damageFlags.

@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void damageFlags(LivingDamageEvent e) {
    if (!e.getEntityLiving().isEffectiveAi())
        return;
    if (e.getSource().getEntity() instanceof LivingEntity) {
        LivingEntity attacker = (LivingEntity) e.getSource().getEntity();
        ISkillCapability isc = CasterData.getCap(attacker);
        for (Skill s : isc.getEquippedSkills()) {
            isc.getSkillData(s).ifPresent(d -> s.onProc(attacker, e, d.getState(), d, e.getEntityLiving()));
        }
    }
    ISkillCapability isc = CasterData.getCap(e.getEntityLiving());
    for (Skill s : isc.getEquippedSkills()) {
        isc.getSkillData(s).ifPresent(d -> s.onProc(e.getEntityLiving(), e, d.getState(), d, null));
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) Skill(jackiecrazy.wardance.skill.Skill) ISkillCapability(jackiecrazy.wardance.capability.skill.ISkillCapability) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Example 7 with ISkillCapability

use of jackiecrazy.wardance.capability.skill.ISkillCapability in project WarDance by Jackiecrazy.

the class SkillEventHandler method hurtFlags.

@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void hurtFlags(LivingHurtEvent e) {
    if (!e.getEntityLiving().isEffectiveAi())
        return;
    if (e.getSource().getEntity() instanceof LivingEntity) {
        LivingEntity attacker = (LivingEntity) e.getSource().getEntity();
        ISkillCapability isc = CasterData.getCap(attacker);
        for (Skill s : isc.getEquippedSkills()) {
            isc.getSkillData(s).ifPresent(d -> s.onProc(attacker, e, d.getState(), d, e.getEntityLiving()));
        }
    }
    ISkillCapability isc = CasterData.getCap(e.getEntityLiving());
    for (Skill s : isc.getEquippedSkills()) {
        isc.getSkillData(s).ifPresent(d -> s.onProc(e.getEntityLiving(), e, d.getState(), d, null));
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) Skill(jackiecrazy.wardance.skill.Skill) ISkillCapability(jackiecrazy.wardance.capability.skill.ISkillCapability) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Example 8 with ISkillCapability

use of jackiecrazy.wardance.capability.skill.ISkillCapability in project WarDance by Jackiecrazy.

the class SkillEventHandler method knockbackFlags.

@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void knockbackFlags(MeleeKnockbackEvent e) {
    if (!e.getEntityLiving().isEffectiveAi())
        return;
    if (e.getAttacker() != null) {
        LivingEntity attacker = e.getAttacker();
        ISkillCapability isc = CasterData.getCap(attacker);
        for (Skill s : isc.getEquippedSkills()) {
            isc.getSkillData(s).ifPresent(d -> s.onProc(attacker, e, d.getState(), d, e.getEntityLiving()));
        }
    }
    ISkillCapability isc = CasterData.getCap(e.getEntityLiving());
    for (Skill s : isc.getEquippedSkills()) {
        isc.getSkillData(s).ifPresent(d -> s.onProc(e.getEntityLiving(), e, d.getState(), d, e.getAttacker()));
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) Skill(jackiecrazy.wardance.skill.Skill) ISkillCapability(jackiecrazy.wardance.capability.skill.ISkillCapability) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Example 9 with ISkillCapability

use of jackiecrazy.wardance.capability.skill.ISkillCapability in project WarDance by Jackiecrazy.

the class SkillEventHandler method hurtFlagS.

@SubscribeEvent(priority = EventPriority.LOWEST)
public static void hurtFlagS(LivingHurtEvent e) {
    if (!e.getEntityLiving().isEffectiveAi())
        return;
    if (e.getSource().getEntity() instanceof LivingEntity) {
        LivingEntity attacker = (LivingEntity) e.getSource().getEntity();
        ISkillCapability isc = CasterData.getCap(attacker);
        for (Skill s : isc.getEquippedSkills()) {
            isc.getSkillData(s).ifPresent(d -> s.onProc(attacker, e, d.getState(), d, e.getEntityLiving()));
        }
    }
    ISkillCapability isc = CasterData.getCap(e.getEntityLiving());
    for (Skill s : isc.getEquippedSkills()) {
        isc.getSkillData(s).ifPresent(d -> s.onProc(e.getEntityLiving(), e, d.getState(), d, null));
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) Skill(jackiecrazy.wardance.skill.Skill) ISkillCapability(jackiecrazy.wardance.capability.skill.ISkillCapability) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Example 10 with ISkillCapability

use of jackiecrazy.wardance.capability.skill.ISkillCapability in project WarDance by Jackiecrazy.

the class SkillEventHandler method parryFlagS.

@SubscribeEvent(priority = EventPriority.LOWEST)
public static void parryFlagS(ParryEvent e) {
    if (!e.getEntityLiving().isEffectiveAi())
        return;
    if (e.getAttacker() != null) {
        LivingEntity attacker = e.getAttacker();
        ISkillCapability isc = CasterData.getCap(attacker);
        for (Skill s : isc.getEquippedSkills()) {
            isc.getSkillData(s).ifPresent(d -> s.onProc(attacker, e, d.getState(), d, e.getEntityLiving()));
        }
    }
    ISkillCapability isc = CasterData.getCap(e.getEntityLiving());
    for (Skill s : isc.getEquippedSkills()) {
        isc.getSkillData(s).ifPresent(d -> s.onProc(e.getEntityLiving(), e, d.getState(), d, e.getAttacker()));
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) Skill(jackiecrazy.wardance.skill.Skill) ISkillCapability(jackiecrazy.wardance.capability.skill.ISkillCapability) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Aggregations

ISkillCapability (jackiecrazy.wardance.capability.skill.ISkillCapability)24 SubscribeEvent (net.minecraftforge.eventbus.api.SubscribeEvent)24 Skill (jackiecrazy.wardance.skill.Skill)23 LivingEntity (net.minecraft.entity.LivingEntity)22 ICombatCapability (jackiecrazy.wardance.capability.resources.ICombatCapability)3 Entity (net.minecraft.entity.Entity)2 MatrixStack (com.mojang.blaze3d.matrix.MatrixStack)1 Pair (com.mojang.datafixers.util.Pair)1 CombatDamageSource (jackiecrazy.wardance.api.CombatDamageSource)1 CoupDeGrace (jackiecrazy.wardance.skill.coupdegrace.CoupDeGrace)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 GameSettings (net.minecraft.client.GameSettings)1 MainWindow (net.minecraft.client.MainWindow)1 Minecraft (net.minecraft.client.Minecraft)1 ClientPlayerEntity (net.minecraft.client.entity.player.ClientPlayerEntity)1 PlayerEntity (net.minecraft.entity.player.PlayerEntity)1 ItemStack (net.minecraft.item.ItemStack)1 HandSide (net.minecraft.util.HandSide)1