pocketmine\level\format\mcregion\Chunk::setBlock PHP Метод

setBlock() публичный Метод

public setBlock ( $x, $y, $z, $blockId = null, $meta = null )
    public function setBlock($x, $y, $z, $blockId = null, $meta = null)
    {
        $i = $x << 11 | $z << 7 | $y;
        $changed = false;
        if ($blockId !== null) {
            $blockId = chr($blockId);
            if ($this->blocks[$i] !== $blockId) {
                $this->blocks[$i] = $blockId;
                $changed = true;
            }
        }
        if ($meta !== null) {
            $i >>= 1;
            $old_m = ord($this->data[$i]);
            if (($y & 1) === 0) {
                $this->data[$i] = chr($old_m & 0xf0 | $meta & 0xf);
                if (($old_m & 0xf) !== $meta) {
                    $changed = true;
                }
            } else {
                $this->data[$i] = chr(($meta & 0xf) << 4 | $old_m & 0xf);
                if (($old_m & 0xf0) >> 4 !== $meta) {
                    $changed = true;
                }
            }
        }
        if ($changed) {
            $this->hasChanged = true;
        }
        return $changed;
    }