Merge branch 'release/3.5'

This commit is contained in:
Dylan K. Taylor
2018-12-30 17:33:31 +00:00
5 changed files with 19 additions and 17 deletions

View File

@ -114,7 +114,9 @@ class ClientboundMapItemDataPacket extends DataPacket{
$this->yOffset = $this->getVarInt();
$count = $this->getUnsignedVarInt();
assert($count === $this->width * $this->height);
if($count !== $this->width * $this->height){
throw new \UnexpectedValueException("Expected colour count of " . ($this->height * $this->width) . " (height $this->height * width $this->width), got $count");
}
for($y = 0; $y < $this->height; ++$y){
for($x = 0; $x < $this->width; ++$x){

View File

@ -69,7 +69,9 @@ abstract class DataPacket extends NetworkBinaryStream{
protected function decodeHeader() : void{
$pid = $this->getUnsignedVarInt();
assert($pid === static::NETWORK_ID);
if($pid !== static::NETWORK_ID){
throw new \UnexpectedValueException("Expected " . static::NETWORK_ID . " for packet ID, got $pid");
}
}
/**