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;
}
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;
}
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;
}
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;
}
Aggregations