Added PlayerEntityInteractEvent (#4374)

This commit is contained in:
marshall
2021-08-24 18:56:10 +08:00
committed by GitHub
parent 224d71f272
commit 6e68e99ec0
3 changed files with 75 additions and 1 deletions

View File

@ -1058,6 +1058,13 @@ abstract class Entity{
}
/**
* Called when interacted or tapped by a Player. Returns whether something happened as a result of the interaction.
*/
public function onInteract(Player $player, Vector3 $clickPos) : bool{
return false;
}
public function isUnderwater() : bool{
$block = $this->getWorld()->getBlockAt((int) floor($this->location->x), $blockY = (int) floor($y = ($this->location->y + $this->getEyeHeight())), (int) floor($this->location->z));