Cleanup damage source a bit (#12106)
This commit is contained in:
@@ -314,7 +314,7 @@
|
||||
&& !this.isSprinting();
|
||||
+ flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits
|
||||
if (flag2) {
|
||||
+ damageSource = damageSource.critical(true); // Paper start - critical damage API
|
||||
+ damageSource = damageSource.critical(); // Paper - critical damage API
|
||||
f *= 1.5F;
|
||||
}
|
||||
|
||||
@@ -342,12 +342,14 @@
|
||||
}
|
||||
|
||||
if (flag3) {
|
||||
@@ -1212,43 +_,62 @@
|
||||
@@ -1212,43 +_,64 @@
|
||||
&& (!(livingEntity2 instanceof ArmorStand) || !((ArmorStand)livingEntity2).isMarker())
|
||||
&& this.distanceToSqr(livingEntity2) < 9.0) {
|
||||
float f6 = this.getEnchantedDamage(livingEntity2, f5, damageSource) * attackStrengthScale;
|
||||
+ // CraftBukkit start - Only apply knockback if the damage hits
|
||||
+ if (!livingEntity2.hurtServer((ServerLevel) this.level(), this.damageSources().playerAttack(this).sweep().critical(flag2), f6)) { // Paper - add critical damage API
|
||||
+ // CraftBukkit start - Only apply knockback if the event is not cancelled
|
||||
+ livingEntity2.lastDamageCancelled = false;
|
||||
+ livingEntity2.hurtServer((ServerLevel) this.level(), damageSource.knownCause(org.bukkit.event.entity.EntityDamageEvent.DamageCause.ENTITY_SWEEP_ATTACK), f6);
|
||||
+ if (livingEntity2.lastDamageCancelled) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
Reference in New Issue
Block a user