Living: do not apply noDamageTicks to suicide damage

suicide damage is a voluntary damage source, which noDamageTicks is intended to prevent getting damaged while the player gets their bearings after (re)spawning.
This commit is contained in:
Dylan K. Taylor 2023-07-19 11:43:09 +01:00
parent f38aee1fc5
commit 4637aae621
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -504,7 +504,7 @@ abstract class Living extends Entity{
}
public function attack(EntityDamageEvent $source) : void{
if($this->noDamageTicks > 0){
if($this->noDamageTicks > 0 && $source->getCause() !== EntityDamageEvent::CAUSE_SUICIDE){
$source->cancel();
}