Level: Remove obsolete \$direct parameter from setBlock()

this parameter was previously used to send blocks with a different set of flags, immediately, to players. However, the flags have been demonstrated useless and the direct sending is pointless now since packets are buffered now per session, so we might as well take advantage of the batched block update sending.
This commit is contained in:
Dylan K. Taylor
2018-09-27 16:15:07 +01:00
parent 16f2ac14b3
commit 75f364fcf2
37 changed files with 71 additions and 82 deletions

View File

@ -248,13 +248,13 @@ abstract class Liquid extends Transparent{
if($newDecay !== $this->decay or $falling !== $this->falling){
if(!$falling and $newDecay < 0){
$this->level->setBlock($this, BlockFactory::get(Block::AIR), true, true);
$this->level->setBlock($this, BlockFactory::get(Block::AIR));
return;
}
$this->falling = $falling;
$this->decay = $falling ? 0 : $newDecay;
$this->level->setBlock($this, $this, true, true); //local block update will cause an update to be scheduled
$this->level->setBlock($this, $this); //local block update will cause an update to be scheduled
}
}
@ -302,7 +302,7 @@ abstract class Liquid extends Transparent{
$new = clone $this;
$new->falling = $falling;
$new->decay = $falling ? 0 : $newFlowDecay;
$this->level->setBlock($block, $new, true, true);
$this->level->setBlock($block, $new);
}
}
@ -432,7 +432,7 @@ abstract class Liquid extends Transparent{
protected function liquidCollide(Block $cause, Block $result) : bool{
//TODO: add events
$this->level->setBlock($this, $result, true, true);
$this->level->setBlock($this, $result);
$this->level->broadcastLevelSoundEvent($this->add(0.5, 0.5, 0.5), LevelSoundEventPacket::SOUND_FIZZ, (int) ((2.6 + (lcg_value() - lcg_value()) * 0.8) * 1000));
return true;
}