mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 01:39:52 +00:00
Merge branch 'release/3.5'
This commit is contained in:
commit
e0558d2551
@ -230,7 +230,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
/** @var int */
|
||||
protected $spawnThreshold;
|
||||
/** @var int */
|
||||
protected $chunkLoadCount = 0;
|
||||
protected $spawnChunkLoadCount = 0;
|
||||
/** @var int */
|
||||
protected $chunksPerTick;
|
||||
|
||||
@ -904,7 +904,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}
|
||||
|
||||
$this->usedChunks[Level::chunkHash($x, $z)] = true;
|
||||
$this->chunkLoadCount++;
|
||||
|
||||
$this->networkSession->queueCompressed($promise);
|
||||
|
||||
@ -914,7 +913,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
$entity->spawnTo($this);
|
||||
}
|
||||
}
|
||||
}elseif($this->chunkLoadCount >= $this->spawnThreshold){
|
||||
}elseif(++$this->spawnChunkLoadCount >= $this->spawnThreshold){
|
||||
$this->spawnChunkLoadCount = -1;
|
||||
$this->spawned = true;
|
||||
|
||||
foreach($this->usedChunks as $index => $c){
|
||||
|
@ -629,6 +629,9 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
* @param float $value
|
||||
*/
|
||||
public function setScale(float $value) : void{
|
||||
if($value <= 0){
|
||||
throw new \InvalidArgumentException("Scale must be greater than 0");
|
||||
}
|
||||
$multiplier = $value / $this->getScale();
|
||||
|
||||
$this->width *= $multiplier;
|
||||
|
@ -455,7 +455,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
if(!is_array($pk)){
|
||||
$pk = [$pk];
|
||||
}
|
||||
|
||||
if(!empty($pk)){
|
||||
if($players === null){
|
||||
foreach($pk as $e){
|
||||
$this->broadcastPacketToViewers($sound, $e);
|
||||
@ -464,13 +464,14 @@ class Level implements ChunkManager, Metadatable{
|
||||
$this->server->broadcastPackets($players, $pk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function addParticle(Particle $particle, array $players = null){
|
||||
$pk = $particle->encode();
|
||||
if(!is_array($pk)){
|
||||
$pk = [$pk];
|
||||
}
|
||||
|
||||
if(!empty($pk)){
|
||||
if($players === null){
|
||||
foreach($pk as $e){
|
||||
$this->broadcastPacketToViewers($particle, $e);
|
||||
@ -479,6 +480,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
$this->server->broadcastPackets($players, $pk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcasts a LevelEvent to players in the area. This could be sound, particles, weather changes, etc.
|
||||
|
Loading…
x
Reference in New Issue
Block a user