30        if(count($heights) !== 256){
 
   31            throw new \InvalidArgumentException(
"Expected exactly 256 heightmap values");
 
 
   36    public function getHeights() : array{ return $this->heights; }
 
   38    public function getHeight(
int $x, 
int $z) : int{
 
   39        return $this->heights[(($z & 0xf) << 4) | ($x & 0xf)];
 
   42    public static function read(ByteBufferReader $in) : self{
 
   44        for($i = 0; $i < 256; ++$i){
 
   45            $heights[] = Byte::readSigned($in);
 
   47        return new self($heights);
 
   50    public function write(ByteBufferWriter $out) : void{
 
   51        for($i = 0; $i < 256; ++$i){
 
   52            Byte::writeSigned($out, $this->heights[$i]);
 
   56    public static function allTooLow() : self{
 
   57        return new self(array_fill(0, 256, -1));
 
   60    public static function allTooHigh() : self{
 
   61        return new self(array_fill(0, 256, 16));
 
   64    public function isAllTooLow() : bool{
 
   65        foreach($this->heights as $height){
 
   73    public function isAllTooHigh() : bool{
 
   74        foreach($this->heights as $height){