Search in sources :

Example 31 with Skill

use of jackiecrazy.wardance.skill.Skill in project WarDance by Jackiecrazy.

the class SkillEventHandler method dropse.

@SubscribeEvent(priority = EventPriority.LOWEST)
public static void dropse(LivingDropsEvent e) {
    if (e.getEntityLiving() != null && !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 32 with Skill

use of jackiecrazy.wardance.skill.Skill in project WarDance by Jackiecrazy.

the class SkillEventHandler method knockbackFlagS.

@SubscribeEvent(priority = EventPriority.LOWEST)
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)

Aggregations

Skill (jackiecrazy.wardance.skill.Skill)32 ISkillCapability (jackiecrazy.wardance.capability.skill.ISkillCapability)23 SubscribeEvent (net.minecraftforge.eventbus.api.SubscribeEvent)23 LivingEntity (net.minecraft.entity.LivingEntity)21 MatrixStack (com.mojang.blaze3d.matrix.MatrixStack)3 ICombatCapability (jackiecrazy.wardance.capability.resources.ICombatCapability)3 SkillData (jackiecrazy.wardance.skill.SkillData)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Minecraft (net.minecraft.client.Minecraft)3 PlayerEntity (net.minecraft.entity.player.PlayerEntity)3 ResourceLocation (net.minecraft.util.ResourceLocation)3 TranslationTextComponent (net.minecraft.util.text.TranslationTextComponent)3 RenderSystem (com.mojang.blaze3d.systems.RenderSystem)2 WarDance (jackiecrazy.wardance.WarDance)2 CasterData (jackiecrazy.wardance.capability.skill.CasterData)2 CombatChannel (jackiecrazy.wardance.networking.CombatChannel)2 UpdateSkillSelectionPacket (jackiecrazy.wardance.networking.UpdateSkillSelectionPacket)2 Screen (net.minecraft.client.gui.screen.Screen)2 Tessellator (net.minecraft.client.renderer.Tessellator)2