diff --git a/src/player/Player.php b/src/player/Player.php index 2cce880e8..32ff6a2dd 100644 --- a/src/player/Player.php +++ b/src/player/Player.php @@ -1577,7 +1577,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener, //TODO: improve this to take stuff like swimming, ladders, enchanted tools into account, fix wrong tool break time calculations for bad tools (pmmp/PocketMine-MP#211) $breakTime = ceil($target->getBreakInfo()->getBreakTime($this->inventory->getItemInHand()) * 20); if($breakTime > 0){ - $this->getWorld()->broadcastLevelEvent($pos, LevelEventPacket::EVENT_BLOCK_START_BREAK, (int) (65535 / $breakTime)); + $this->getWorld()->broadcastPacketToViewers($pos, LevelEventPacket::create(LevelEventPacket::EVENT_BLOCK_START_BREAK, (int) (65535 / $breakTime), $pos)); } } @@ -1594,7 +1594,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener, } public function stopBreakBlock(Vector3 $pos) : void{ - $this->getWorld()->broadcastLevelEvent($pos, LevelEventPacket::EVENT_BLOCK_STOP_BREAK); + $this->getWorld()->broadcastPacketToViewers($pos, LevelEventPacket::create(LevelEventPacket::EVENT_BLOCK_STOP_BREAK, 0, $pos)); } /** diff --git a/src/world/World.php b/src/world/World.php index ae4214f9c..022c64b3b 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -477,20 +477,6 @@ class World implements ChunkManager{ } } - /** - * Broadcasts a LevelEvent to players in the area. This could be sound, particles, weather changes, etc. - * - * @param Vector3|null $pos If null, broadcasts to every player in the World - */ - public function broadcastLevelEvent(?Vector3 $pos, int $evid, int $data = 0) : void{ - $pk = LevelEventPacket::create($evid, $data, $pos); - if($pos !== null){ - $this->broadcastPacketToViewers($pos, $pk); - }else{ - $this->broadcastGlobalPacket($pk); - } - } - public function getAutoSave() : bool{ return $this->autoSave; }