|
| __construct (string $ids="", string $data="", string $skyLight="", string $blockLight="") |
|
| isEmpty () |
|
| getBlockId (int $x, int $y, int $z) |
|
| setBlockId (int $x, int $y, int $z, int $id) |
|
| getBlockData (int $x, int $y, int $z) |
|
| setBlockData (int $x, int $y, int $z, int $data) |
|
| getFullBlock (int $x, int $y, int $z) |
|
| setBlock (int $x, int $y, int $z, $id=null, $data=null) |
|
| getBlockLight (int $x, int $y, int $z) |
|
| setBlockLight (int $x, int $y, int $z, int $level) |
|
| getBlockSkyLight (int $x, int $y, int $z) |
|
| setBlockSkyLight (int $x, int $y, int $z, int $level) |
|
| getHighestBlockAt (int $x, int $z) |
|
| getBlockIdColumn (int $x, int $z) |
|
| getBlockDataColumn (int $x, int $z) |
|
| getBlockLightColumn (int $x, int $z) |
|
| getSkyLightColumn (int $x, int $z) |
|
| getBlockIdArray () |
|
| getBlockDataArray () |
|
| getSkyLightArray () |
|
| getBlockLightArray () |
|
| networkSerialize () |
|
| fastSerialize () |
|
◆ __construct()
__construct |
( |
string |
$ids = "" , |
|
|
string |
$data = "" , |
|
|
string |
$skyLight = "" , |
|
|
string |
$blockLight = "" |
|
) |
| |
SubChunk constructor.
- Parameters
-
string | $ids | |
string | $data | |
string | $skyLight | |
string | $blockLight | |
57 self::assignData($this->ids,
$ids, 4096);
58 self::assignData($this->data,
$data, 2048);
59 self::assignData($this->skyLight,
$skyLight, 2048,
"\xff");
60 self::assignData($this->blockLight,
$blockLight, 2048);
◆ fastDeserialize()
static fastDeserialize |
( |
string |
$data | ) |
|
|
static |
- Parameters
-
- Returns
- SubChunk
365 substr(
$data, 0, 4096),
366 substr(
$data, 4096, 2048),
367 substr(
$data, 6144, 2048),
368 substr(
$data, 8192, 2048)
◆ fastSerialize()
◆ getBlockData()
getBlockData |
( |
int |
$x, |
|
|
int |
$y, |
|
|
int |
$z |
|
) |
| |
- Parameters
-
- Returns
- int
103 $m = ord($this->data{($x << 7) + ($z << 3) + ($y >> 1)});
◆ getBlockDataArray()
- Returns
- string
319 assert(strlen($this->data) === 2048,
"Wrong length of data array, expecting 2048 bytes, got " . strlen($this->data));
◆ getBlockDataColumn()
getBlockDataColumn |
( |
int |
$x, |
|
|
int |
$z |
|
) |
| |
- Parameters
-
- Returns
- string
284 return substr($this->data, (($x << 7) | ($z << 3)), 8);
◆ getBlockId()
getBlockId |
( |
int |
$x, |
|
|
int |
$y, |
|
|
int |
$z |
|
) |
| |
- Parameters
-
- Returns
- int
79 return ord($this->ids{($x << 8) | ($z << 4) | $y});
◆ getBlockIdArray()
- Returns
- string
311 assert(strlen($this->ids) === 4096,
"Wrong length of ID array, expecting 4096 bytes, got " . strlen($this->ids));
◆ getBlockIdColumn()
getBlockIdColumn |
( |
int |
$x, |
|
|
int |
$z |
|
) |
| |
- Parameters
-
- Returns
- string
274 return substr($this->ids, (($x << 8) | ($z << 4)), 16);
◆ getBlockLight()
getBlockLight |
( |
int |
$x, |
|
|
int |
$y, |
|
|
int |
$z |
|
) |
| |
- Parameters
-
- Returns
- int
189 $byte = ord($this->blockLight{($x << 7) + ($z << 3) + ($y >> 1)});
◆ getBlockLightArray()
- Returns
- string
335 assert(strlen($this->blockLight) === 2048,
"Wrong length of light array, expecting 2048 bytes, got " . strlen($this->blockLight));
◆ getBlockLightColumn()
getBlockLightColumn |
( |
int |
$x, |
|
|
int |
$z |
|
) |
| |
- Parameters
-
- Returns
- string
294 return substr($this->blockLight, (($x << 7) | ($z << 3)), 8);
◆ getBlockSkyLight()
getBlockSkyLight |
( |
int |
$x, |
|
|
int |
$y, |
|
|
int |
$z |
|
) |
| |
- Parameters
-
- Returns
- int
224 $byte = ord($this->skyLight{($x << 7) + ($z << 3) + ($y >> 1)});
◆ getFullBlock()
getFullBlock |
( |
int |
$x, |
|
|
int |
$y, |
|
|
int |
$z |
|
) |
| |
- Parameters
-
- Returns
- int
137 $i = ($x << 8) | ($z << 4) | $y;
139 return (ord($this->ids{$i}) << 4) | (ord($this->data{$i >> 1}) & 0x0f);
141 return (ord($this->ids{$i}) << 4) | (ord($this->data{$i >> 1}) >> 4);
◆ getHighestBlockAt()
getHighestBlockAt |
( |
int |
$x, |
|
|
int |
$z |
|
) |
| |
- Parameters
-
- Returns
- int
258 for($y = 15; $y >= 0; --$y){
259 if($this->ids{($x << 8) | ($z << 4) | $y} !==
"\x00"){
◆ getSkyLightArray()
- Returns
- string
327 assert(strlen($this->skyLight) === 2048,
"Wrong length of skylight array, expecting 2048 bytes, got " . strlen($this->skyLight));
◆ getSkyLightColumn()
getSkyLightColumn |
( |
int |
$x, |
|
|
int |
$z |
|
) |
| |
- Parameters
-
- Returns
- string
304 return substr($this->skyLight, (($x << 7) | ($z << 3)), 8);
◆ isEmpty()
- Returns
- bool
67 assert(strlen($this->ids) === 4096,
"Wrong length of ID array, expecting 4096 bytes, got " . strlen($this->ids));
68 return substr_count($this->ids,
"\x00") === 4096;
◆ networkSerialize()
◆ setBlock()
setBlock |
( |
int |
$x, |
|
|
int |
$y, |
|
|
int |
$z, |
|
|
|
$id = null , |
|
|
|
$data = null |
|
) |
| |
- Parameters
-
int | $x | |
int | $y | |
int | $z | |
null | $id | |
null | $data | |
- Returns
- bool
155 $i = ($x << 8) | ($z << 4) | $y;
159 if($this->ids{$i} !== $block){
160 $this->ids{$i} = $block;
167 $byte = ord($this->data{$i});
169 $this->data{$i} = chr(($byte & 0xf0) | (
$data & 0x0f));
171 $this->data{$i} = chr(((
$data & 0x0f) << 4) | ($byte & 0x0f));
173 if($this->data{$i} !== $byte){
◆ setBlockData()
setBlockData |
( |
int |
$x, |
|
|
int |
$y, |
|
|
int |
$z, |
|
|
int |
$data |
|
) |
| |
- Parameters
-
int | $x | |
int | $y | |
int | $z | |
int | $data | |
- Returns
- bool
120 $i = ($x << 7) | ($z << 3) | ($y >> 1);
122 $this->data{$i} = chr((ord($this->data{$i}) & 0xf0) | (
$data & 0x0f));
124 $this->data{$i} = chr(((
$data & 0x0f) << 4) | (ord($this->data{$i}) & 0x0f));
◆ setBlockId()
setBlockId |
( |
int |
$x, |
|
|
int |
$y, |
|
|
int |
$z, |
|
|
int |
$id |
|
) |
| |
- Parameters
-
- Returns
- bool
91 $this->ids{($x << 8) | ($z << 4) | $y} = chr($id);
◆ setBlockLight()
setBlockLight |
( |
int |
$x, |
|
|
int |
$y, |
|
|
int |
$z, |
|
|
int |
$level |
|
) |
| |
- Parameters
-
int | $x | |
int | $y | |
int | $z | |
int | $level | |
- Returns
- bool
206 $i = ($x << 7) + ($z << 3) + ($y >> 1);
207 $byte = ord($this->blockLight{$i});
209 $this->blockLight{$i} = chr(($byte & 0xf0) | ($level & 0x0f));
211 $this->blockLight{$i} = chr((($level & 0x0f) << 4) | ($byte & 0x0f));
◆ setBlockSkyLight()
setBlockSkyLight |
( |
int |
$x, |
|
|
int |
$y, |
|
|
int |
$z, |
|
|
int |
$level |
|
) |
| |
- Parameters
-
int | $x | |
int | $y | |
int | $z | |
int | $level | |
- Returns
- bool
241 $i = ($x << 7) + ($z << 3) + ($y >> 1);
242 $byte = ord($this->skyLight{$i});
244 $this->skyLight{$i} = chr(($byte & 0xf0) | ($level & 0x0f));
246 $this->skyLight{$i} = chr((($level & 0x0f) << 4) | ($byte & 0x0f));
◆ $blockLight
◆ $data
◆ $ids
◆ $skyLight
The documentation for this class was generated from the following file:
- src/pocketmine/level/format/SubChunk.php