fix(Entity): broadcastSound() not firing WorldSoundEvent (#6069)

This commit is contained in:
Doge 2023-10-08 21:25:19 +03:00 committed by GitHub
parent ed4088755f
commit 94a17f59d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1686,7 +1686,7 @@ abstract class Entity{
*/
public function broadcastSound(Sound $sound, ?array $targets = null) : void{
if(!$this->silent){
NetworkBroadcastUtils::broadcastPackets($targets ?? $this->getViewers(), $sound->encode($this->location));
$this->getWorld()->addSound($this->location->asVector3(), $sound, $targets ?? $this->getViewers());
}
}