mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-18 11:45:30 +00:00
World: remove protocol-specialized broadcastLevelEvent()
This commit is contained in:
parent
f34753c496
commit
b1021315b0
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user