29 if(count($heights) !== 256){
30 throw new \InvalidArgumentException(
"Expected exactly 256 heightmap values");
35 public function getHeights() : array{ return $this->heights; }
37 public function getHeight(
int $x,
int $z) : int{
38 return $this->heights[(($z & 0xf) << 4) | ($x & 0xf)];
43 for($i = 0; $i < 256; ++$i){
44 $heights[] = Binary::signByte($in->
getByte());
46 return new self($heights);
49 public function write(PacketSerializer $out) : void{
50 for($i = 0; $i < 256; ++$i){
51 $out->putByte(Binary::unsignByte($this->heights[$i]));
55 public static function allTooLow() : self{
56 return new self(array_fill(0, 256, -1));
59 public static function allTooHigh() : self{
60 return new self(array_fill(0, 256, 16));
63 public function isAllTooLow() : bool{
64 foreach($this->heights as $height){
72 public function isAllTooHigh() : bool{
73 foreach($this->heights as $height){