optimise explosion damage further

and use the right entity for the dragon part damage
This commit is contained in:
Lulu13022002 2023-12-08 20:47:27 +01:00
parent 40d0f2da71
commit 4fc499dde8

View file

@ -451,10 +451,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Calculate damage separately for each EntityComplexPart // Calculate damage separately for each EntityComplexPart
if (list.contains(entityComplexPart)) { if (list.contains(entityComplexPart)) {
- entityComplexPart.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity)); - entityComplexPart.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity));
+ entityComplexPart.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity, getSeenFraction(vec3d, entityComplexPart, blockCache, blockPos))); // Paper - actually optimise explosions + entityComplexPart.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entityComplexPart, getSeenFraction(vec3d, entityComplexPart, blockCache, blockPos))); // Paper - actually optimise explosions and use the right entity to calculate the damage
} }
} }
} else { } else {
- entity.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity));
+ entity.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity, getSeenFraction(vec3d, entity, blockCache, blockPos))); // Paper - actually optimise explosions
}
CraftEventFactory.entityDamage = null;
@@ -0,0 +0,0 @@ public class Explosion { @@ -0,0 +0,0 @@ public class Explosion {
// CraftBukkit end // CraftBukkit end
} }
@ -497,8 +502,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java --- a/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java
+++ b/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java +++ b/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java
@@ -0,0 +0,0 @@ public class ExplosionDamageCalculator { @@ -0,0 +0,0 @@ public class ExplosionDamageCalculator {
return true;
} }
+ @io.papermc.paper.annotation.DoNotUse @Deprecated // Paper
public float getEntityDamageAmount(Explosion explosion, Entity entity) { public float getEntityDamageAmount(Explosion explosion, Entity entity) {
+ // Paper start - actually optimise explosions + // Paper start - actually optimise explosions
+ return this.getEntityDamageAmount(explosion, entity, Explosion.getSeenPercent(explosion.center(), entity)); + return this.getEntityDamageAmount(explosion, entity, Explosion.getSeenPercent(explosion.center(), entity));