Search in sources :

Example 1 with ISentientSwordEffectProvider

use of WayofTime.bloodmagic.iface.ISentientSwordEffectProvider in project BloodMagic by WayofTime.

the class ItemSentientAxe method hitEntity.

@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
    if (super.hitEntity(stack, target, attacker)) {
        if (attacker instanceof EntityPlayer) {
            EntityPlayer attackerPlayer = (EntityPlayer) attacker;
            this.recalculatePowers(stack, attackerPlayer.getEntityWorld(), attackerPlayer);
            EnumDemonWillType type = this.getCurrentType(stack);
            double will = PlayerDemonWillHandler.getTotalDemonWill(type, attackerPlayer);
            int willBracket = this.getLevel(stack, will);
            applyEffectToEntity(type, willBracket, target, attackerPlayer);
            ItemStack offStack = attackerPlayer.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
            if (offStack.getItem() instanceof ISentientSwordEffectProvider) {
                ISentientSwordEffectProvider provider = (ISentientSwordEffectProvider) offStack.getItem();
                if (provider.providesEffectForWill(type)) {
                    provider.applyOnHitEffect(type, stack, offStack, attacker, target);
                }
            }
        }
        return true;
    }
    return false;
}
Also used : EntityPlayer(net.minecraft.entity.player.EntityPlayer) ISentientSwordEffectProvider(WayofTime.bloodmagic.iface.ISentientSwordEffectProvider) EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType) ItemStack(net.minecraft.item.ItemStack)

Example 2 with ISentientSwordEffectProvider

use of WayofTime.bloodmagic.iface.ISentientSwordEffectProvider in project BloodMagic by WayofTime.

the class ItemSentientShovel method hitEntity.

@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
    if (super.hitEntity(stack, target, attacker)) {
        if (attacker instanceof EntityPlayer) {
            EntityPlayer attackerPlayer = (EntityPlayer) attacker;
            this.recalculatePowers(stack, attackerPlayer.getEntityWorld(), attackerPlayer);
            EnumDemonWillType type = this.getCurrentType(stack);
            double will = PlayerDemonWillHandler.getTotalDemonWill(type, attackerPlayer);
            int willBracket = this.getLevel(stack, will);
            applyEffectToEntity(type, willBracket, target, attackerPlayer);
            ItemStack offStack = attackerPlayer.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
            if (offStack.getItem() instanceof ISentientSwordEffectProvider) {
                ISentientSwordEffectProvider provider = (ISentientSwordEffectProvider) offStack.getItem();
                if (provider.providesEffectForWill(type)) {
                    provider.applyOnHitEffect(type, stack, offStack, attacker, target);
                }
            }
        }
        return true;
    }
    return false;
}
Also used : EntityPlayer(net.minecraft.entity.player.EntityPlayer) ISentientSwordEffectProvider(WayofTime.bloodmagic.iface.ISentientSwordEffectProvider) EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType) ItemStack(net.minecraft.item.ItemStack)

Example 3 with ISentientSwordEffectProvider

use of WayofTime.bloodmagic.iface.ISentientSwordEffectProvider in project BloodMagic by WayofTime.

the class ItemSentientSword method hitEntity.

@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
    if (super.hitEntity(stack, target, attacker)) {
        if (attacker instanceof EntityPlayer) {
            EntityPlayer attackerPlayer = (EntityPlayer) attacker;
            this.recalculatePowers(stack, attackerPlayer.getEntityWorld(), attackerPlayer);
            EnumDemonWillType type = this.getCurrentType(stack);
            double will = PlayerDemonWillHandler.getTotalDemonWill(type, attackerPlayer);
            int willBracket = this.getLevel(stack, will);
            applyEffectToEntity(type, willBracket, target, attackerPlayer);
            ItemStack offStack = attackerPlayer.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
            if (offStack.getItem() instanceof ISentientSwordEffectProvider) {
                ISentientSwordEffectProvider provider = (ISentientSwordEffectProvider) offStack.getItem();
                if (provider.providesEffectForWill(type)) {
                    provider.applyOnHitEffect(type, stack, offStack, attacker, target);
                }
            }
        }
        return true;
    }
    return false;
}
Also used : EntityPlayer(net.minecraft.entity.player.EntityPlayer) ISentientSwordEffectProvider(WayofTime.bloodmagic.iface.ISentientSwordEffectProvider) EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType) ItemStack(net.minecraft.item.ItemStack)

Example 4 with ISentientSwordEffectProvider

use of WayofTime.bloodmagic.iface.ISentientSwordEffectProvider in project BloodMagic by WayofTime.

the class ItemSentientPickaxe method hitEntity.

@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
    if (super.hitEntity(stack, target, attacker)) {
        if (attacker instanceof EntityPlayer) {
            EntityPlayer attackerPlayer = (EntityPlayer) attacker;
            this.recalculatePowers(stack, attackerPlayer.getEntityWorld(), attackerPlayer);
            EnumDemonWillType type = this.getCurrentType(stack);
            double will = PlayerDemonWillHandler.getTotalDemonWill(type, attackerPlayer);
            int willBracket = this.getLevel(stack, will);
            applyEffectToEntity(type, willBracket, target, attackerPlayer);
            ItemStack offStack = attackerPlayer.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
            if (offStack.getItem() instanceof ISentientSwordEffectProvider) {
                ISentientSwordEffectProvider provider = (ISentientSwordEffectProvider) offStack.getItem();
                if (provider.providesEffectForWill(type)) {
                    provider.applyOnHitEffect(type, stack, offStack, attacker, target);
                }
            }
        }
        return true;
    }
    return false;
}
Also used : EntityPlayer(net.minecraft.entity.player.EntityPlayer) ISentientSwordEffectProvider(WayofTime.bloodmagic.iface.ISentientSwordEffectProvider) EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType) ItemStack(net.minecraft.item.ItemStack)

Aggregations

ISentientSwordEffectProvider (WayofTime.bloodmagic.iface.ISentientSwordEffectProvider)4 EnumDemonWillType (WayofTime.bloodmagic.soul.EnumDemonWillType)4 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 ItemStack (net.minecraft.item.ItemStack)4