Skip to content

Commit 88f1e45

Browse files
committed
Fixed damage calculations once and for all
1 parent 103b695 commit 88f1e45

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

common/src/main/kotlin/com/lambda/util/combat/CombatUtils.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
package com.lambda.util.combat
1919

2020
import com.lambda.context.SafeContext
21-
import com.lambda.util.math.distSq
21+
import com.lambda.util.math.dist
2222
import com.lambda.util.world.fastEntitySearch
2323
import net.minecraft.client.world.ClientWorld
2424
import net.minecraft.entity.EquipmentSlot
@@ -108,10 +108,10 @@ object CombatUtils {
108108
* @param power The [power of the explosion](https://minecraft.wiki/w/Explosion#Damage)
109109
*/
110110
fun SafeContext.explosionDamage(position: Vec3d, entity: LivingEntity, power: Double): Double {
111-
val distance = entity distSq position
111+
val distance = entity dist position
112112

113113
val range = power * 2
114-
val impact = (1 - distance / range) * Explosion.getExposure(position, entity) * 0.4
114+
val impact = (1 - distance / range) * Explosion.getExposure(position, entity)
115115
val damage = (impact * impact + impact) / 2.0 * 7.0 * range + 1
116116

117117
return Explosion.createDamageSource(world, null).scale(world, entity, damage)

0 commit comments

Comments
 (0)