diff --git a/src/block/Block.php b/src/block/Block.php index cddfe0440..38abcfb4f 100644 --- a/src/block/Block.php +++ b/src/block/Block.php @@ -32,6 +32,7 @@ use pocketmine\block\utils\SupportType; use pocketmine\data\runtime\RuntimeDataReader; use pocketmine\data\runtime\RuntimeDataWriter; use pocketmine\entity\Entity; +use pocketmine\entity\projectile\Projectile; use pocketmine\item\enchantment\VanillaEnchantments; use pocketmine\item\Item; use pocketmine\item\ItemBlock; @@ -626,6 +627,13 @@ class Block{ return null; } + /** + * Called when a projectile collides with one of this block's collision boxes. + */ + public function onProjectileHit(Projectile $projectile, RayTraceResult $hitResult) : void{ + //NOOP + } + /** * @return AxisAlignedBB[] */ diff --git a/src/entity/projectile/Projectile.php b/src/entity/projectile/Projectile.php index 41c5aa4cf..74bb5a0a2 100644 --- a/src/entity/projectile/Projectile.php +++ b/src/entity/projectile/Projectile.php @@ -306,5 +306,6 @@ abstract class Projectile extends Entity{ */ protected function onHitBlock(Block $blockHit, RayTraceResult $hitResult) : void{ $this->blockHit = $blockHit->getPosition()->asVector3(); + $blockHit->onProjectileHit($this, $hitResult); } }