mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-05 17:41:46 +00:00
Fixed negative chunk indexes on PMFLevel
This commit is contained in:
parent
4acb4541ab
commit
f0ff420659
@ -169,12 +169,12 @@ class PMFLevel extends PMF{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function getIndex($X, $Z){
|
public static function getIndex($X, $Z){
|
||||||
return ($Z << 16) | ($X < 0 ? (~--$X & 0x7fff) | 0x1000 : $X & 0xFFFF);
|
return ($Z << 16) | ($X < 0 ? (~--$X & 0x7fff) | 0x8000 : $X & 0x7fff);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getXZ($index, &$X = null, &$Z = null){
|
public static function getXZ($index, &$X = null, &$Z = null){
|
||||||
$Z = $index >> 16;
|
$Z = $index >> 16;
|
||||||
$X = $index & 0xFFFF;
|
$X = ($index & 0x8000) === 0x8000 ? -($index & 0x7fff) : $index & 0x7fff;
|
||||||
return array($X, $Z);
|
return array($X, $Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user