mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-11 00:09:39 +00:00
Merge commit '839a789180cb3acd2e16006afa9b787903ffbbcd'
This commit is contained in:
commit
eb6bb1aae1
@ -1687,6 +1687,9 @@ abstract class Entity{
|
||||
$this->networkProperties->setGenericFlag(EntityMetadataFlags::WALLCLIMBING, $this->canClimbWalls);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Player[]|null $players
|
||||
*/
|
||||
public function broadcastEntityEvent(int $eventId, ?int $eventData = null, ?array $players = null) : void{
|
||||
$this->server->broadcastPackets($players ?? $this->getViewers(), [ActorEventPacket::create($this->id, $eventId, $eventData ?? 0)]);
|
||||
}
|
||||
|
@ -631,6 +631,8 @@ abstract class Living extends Entity{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param true[] $transparent
|
||||
*
|
||||
* @return Block[]
|
||||
*/
|
||||
public function getLineOfSight(int $maxDistance, int $maxLength = 0, array $transparent = []) : array{
|
||||
@ -670,6 +672,9 @@ abstract class Living extends Entity{
|
||||
return $blocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param true[] $transparent
|
||||
*/
|
||||
public function getTargetBlock(int $maxDistance, array $transparent = []) : ?Block{
|
||||
$line = $this->getLineOfSight($maxDistance, 1, $transparent);
|
||||
if(count($line) > 0){
|
||||
|
Loading…
x
Reference in New Issue
Block a user