◆ convertBiomeColors()
static convertBiomeColors |
( |
array |
$array | ) |
|
|
static |
Converts pre-MCPE-1.0 biome color array to biome ID array.
- Parameters
-
int[] | $array of biome color values |
- Returns
- string
99 $result = str_repeat(
"\x00", 256);
100 foreach($array as $i => $color){
101 $result{$i} = chr(($color >> 24) & 0xff);
◆ reorderByteArray()
static reorderByteArray |
( |
string |
$array | ) |
|
|
staticfinal |
Re-orders a byte array (YZX -> XZY and vice versa)
- Parameters
-
- Returns
- string length 4096
36 $result = str_repeat(
"\x00", 4096);
37 if($array !== $result){
39 for($x = 0; $x < 16; ++$x){
41 for($z = $x; $z < $zM; $z += 16){
43 for($y = $z; $y < $yM; $y += 256){
44 $result{$i} = $array{$y};
◆ reorderNibbleArray()
static reorderNibbleArray |
( |
string |
$array, |
|
|
string |
$commonValue = "\x00" |
|
) |
| |
|
staticfinal |
Re-orders a nibble array (YZX -> XZY and vice versa)
- Parameters
-
string | $array | length 2048 |
string | $commonValue | length 1 common value to fill the default array with and to expect, may improve sort time |
- Returns
- string length 2048
63 $result = str_repeat($commonValue, 2048);
65 if($array !== $result){
67 for($x = 0; $x < 8; ++$x){
68 for($z = 0; $z < 16; ++$z){
69 $zx = (($z << 3) | $x);
70 for($y = 0; $y < 8; ++$y){
71 $j = (($y << 8) | $zx);
73 if($array{$j} === $commonValue and $array{$j80} === $commonValue){
76 $i1 = ord($array{$j});
77 $i2 = ord($array{$j80});
78 $result{$i} = chr(($i2 << 4) | ($i1 & 0x0f));
79 $result{$i | 0x80} = chr(($i1 >> 4) | ($i2 & 0xf0));
The documentation for this class was generated from the following file:
- src/pocketmine/level/format/io/ChunkUtils.php