Cleanup damage source a bit (#12106)

This commit is contained in:
Lulu13022002
2025-02-16 20:14:00 +01:00
committed by GitHub
parent 608f004a2c
commit 7bee99714a
31 changed files with 135 additions and 215 deletions

View File

@@ -459,7 +459,7 @@
+ // CraftBukkit end
if (this.level() instanceof ServerLevel serverLevel
- && this.hurtServer(serverLevel, this.damageSources().lava(), 4.0F)
+ && this.hurtServer(serverLevel, this.damageSources().lava().directBlock(this.level, this.lastLavaContact), 4.0F) // CraftBukkit - we also don't throw an event unless the object in lava is living, to save on some event calls
+ && this.hurtServer(serverLevel, this.damageSources().lava().eventBlockDamager(this.level, this.lastLavaContact), 4.0F) // CraftBukkit - we also don't throw an event unless the object in lava is living, to save on some event calls
&& this.shouldPlayLavaHurtSound()
&& !this.isSilent()) {
serverLevel.playSound(
@@ -1300,7 +1300,7 @@
+ return;
+ }
+
+ if (!this.hurtServer(level, this.damageSources().lightningBolt().customEventDamager(lightning), 5.0F)) { // Paper - fix DamageSource API
+ if (!this.hurtServer(level, this.damageSources().lightningBolt().eventEntityDamager(lightning), 5.0F)) { // Paper - fix DamageSource API
+ return;
+ }
+ // CraftBukkit end