Merge branch 'release/3.5'

This commit is contained in:
Dylan K. Taylor 2018-12-14 10:03:36 +00:00
commit e0558d2551
3 changed files with 20 additions and 15 deletions

View File

@ -230,7 +230,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** @var int */ /** @var int */
protected $spawnThreshold; protected $spawnThreshold;
/** @var int */ /** @var int */
protected $chunkLoadCount = 0; protected $spawnChunkLoadCount = 0;
/** @var int */ /** @var int */
protected $chunksPerTick; protected $chunksPerTick;
@ -904,7 +904,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
$this->usedChunks[Level::chunkHash($x, $z)] = true; $this->usedChunks[Level::chunkHash($x, $z)] = true;
$this->chunkLoadCount++;
$this->networkSession->queueCompressed($promise); $this->networkSession->queueCompressed($promise);
@ -914,7 +913,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$entity->spawnTo($this); $entity->spawnTo($this);
} }
} }
}elseif($this->chunkLoadCount >= $this->spawnThreshold){ }elseif(++$this->spawnChunkLoadCount >= $this->spawnThreshold){
$this->spawnChunkLoadCount = -1;
$this->spawned = true; $this->spawned = true;
foreach($this->usedChunks as $index => $c){ foreach($this->usedChunks as $index => $c){

View File

@ -629,6 +629,9 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
* @param float $value * @param float $value
*/ */
public function setScale(float $value) : void{ public function setScale(float $value) : void{
if($value <= 0){
throw new \InvalidArgumentException("Scale must be greater than 0");
}
$multiplier = $value / $this->getScale(); $multiplier = $value / $this->getScale();
$this->width *= $multiplier; $this->width *= $multiplier;

View File

@ -455,13 +455,14 @@ class Level implements ChunkManager, Metadatable{
if(!is_array($pk)){ if(!is_array($pk)){
$pk = [$pk]; $pk = [$pk];
} }
if(!empty($pk)){
if($players === null){ if($players === null){
foreach($pk as $e){ foreach($pk as $e){
$this->broadcastPacketToViewers($sound, $e); $this->broadcastPacketToViewers($sound, $e);
}
}else{
$this->server->broadcastPackets($players, $pk);
} }
}else{
$this->server->broadcastPackets($players, $pk);
} }
} }
@ -470,13 +471,14 @@ class Level implements ChunkManager, Metadatable{
if(!is_array($pk)){ if(!is_array($pk)){
$pk = [$pk]; $pk = [$pk];
} }
if(!empty($pk)){
if($players === null){ if($players === null){
foreach($pk as $e){ foreach($pk as $e){
$this->broadcastPacketToViewers($particle, $e); $this->broadcastPacketToViewers($particle, $e);
}
}else{
$this->server->broadcastPackets($players, $pk);
} }
}else{
$this->server->broadcastPackets($players, $pk);
} }
} }