mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-17 04:06:54 +00:00
Merge 'minor-next' into 'major-next'
Automatic merge performed by: https://github.com/pmmp/RestrictedActions/actions/runs/17841374387
This commit is contained in:
@@ -227,12 +227,15 @@ abstract class Projectile extends Entity{
|
||||
$specificHitFunc = fn() => $this->onHitBlock($objectHit, $rayTraceResult);
|
||||
}
|
||||
|
||||
$motionBeforeOnHit = clone $this->motion;
|
||||
$ev->call();
|
||||
$this->onHit($ev);
|
||||
$specificHitFunc();
|
||||
|
||||
$this->isCollided = $this->onGround = true;
|
||||
$this->motion = Vector3::zero();
|
||||
if($motionBeforeOnHit->equals($this->motion)){
|
||||
$this->motion = Vector3::zero();
|
||||
}
|
||||
}else{
|
||||
$this->isCollided = $this->onGround = false;
|
||||
$this->blockHit = null;
|
||||
@@ -295,7 +298,9 @@ abstract class Projectile extends Entity{
|
||||
}
|
||||
}
|
||||
|
||||
$this->flagForDespawn();
|
||||
if($this->despawnsOnEntityHit()){
|
||||
$this->flagForDespawn();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -305,4 +310,11 @@ abstract class Projectile extends Entity{
|
||||
$this->blockHit = $blockHit->getPosition()->asVector3();
|
||||
$blockHit->onProjectileHit($this, $hitResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated This will be dropped in favor of deciding whether to despawn within `onHitEntity()` method.
|
||||
*/
|
||||
protected function despawnsOnEntityHit() : bool{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user