Skip to content

Commit

Permalink
Fixed the crash when hitting a non-living entity with Sentient Harm.
Browse files Browse the repository at this point in the history
  • Loading branch information
sdavisatx97 committed Oct 11, 2021
1 parent 84511df commit 8a1398f
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,19 @@ public void onResolve(RayTraceResult rayTraceResult, World world, LivingEntity s
int bracket = getBracket(type, souls);
//PortUtil.sendMessage(player, new StringTextComponent("Bracket "+ bracket));
Entity entity = ((EntityRayTraceResult) rayTraceResult).getEntity();
if(entity instanceof LivingEntity){
int time = spellStats.getDurationInTicks();
float damage = (float) (4.0f + (2.0f*getExtraDamage(spellContext, type, souls)) + (2.0f * spellStats.getAmpMultiplier()));
//PortUtil.sendMessage(player, new StringTextComponent("Duration is " + time + "Damage is " + damage));
((LivingEntity)entity).addPotionEffect(new EffectInstance(BloodMagicPotions.SOUL_SNARE,300,0));

switch (type) {
case CORROSIVE:
if (entity instanceof LivingEntity) {

//applyPotion((LivingEntity) entity, Effects.WITHER, spellStats , (ItemSentientSword.poisonTime[bracket]*time) , ItemSentientSword.poisonLevel[bracket], true);
((LivingEntity) entity).addPotionEffect(new EffectInstance(Effects.WITHER, (time > 0) ? (ItemSentientSword.poisonTime[bracket]*time):(ItemSentientSword.poisonTime[bracket]), ItemSentientSword.poisonLevel[bracket]+1));
//PortUtil.sendMessage(player, new StringTextComponent("Will Type is " + type.getString()+", "+souls));
}

break;
case DEFAULT:
//PortUtil.sendMessage(player, new StringTextComponent("Will Type is " + type.getString()+", "+souls));
Expand All @@ -87,7 +88,7 @@ public void onResolve(RayTraceResult rayTraceResult, World world, LivingEntity s
}

dealDamage(world,shooter,damage,spellStats,entity,buildDamageSource(world, shooter).setMagicDamage());
}
}}

}

Expand Down

0 comments on commit 8a1398f

Please sign in to comment.