mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 02:08:21 +00:00
Drop support for 32 bit systems/PHP (#984)
* Cutting out 32-bit and minor improvements to bootstrap * Byeeeeee * Removing legacy code * added note to the issue template as suggested by @xxFlare
This commit is contained in:
@ -265,24 +265,17 @@ class Level implements ChunkManager, Metadatable{
|
||||
private $closed = false;
|
||||
|
||||
public static function chunkHash(int $x, int $z){
|
||||
return PHP_INT_SIZE === 8 ? (($x & 0xFFFFFFFF) << 32) | ($z & 0xFFFFFFFF) : $x . ":" . $z;
|
||||
return (($x & 0xFFFFFFFF) << 32) | ($z & 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
public static function blockHash(int $x, int $y, int $z){
|
||||
return PHP_INT_SIZE === 8 ? (($x & 0xFFFFFFF) << 36) | (($y & Level::Y_MASK) << 28) | ($z & 0xFFFFFFF) : $x . ":" . $y . ":" . $z;
|
||||
return (($x & 0xFFFFFFF) << 36) | (($y & Level::Y_MASK) << 28) | ($z & 0xFFFFFFF);
|
||||
}
|
||||
|
||||
public static function getBlockXYZ($hash, &$x, &$y, &$z){
|
||||
if(PHP_INT_SIZE === 8){
|
||||
$x = $hash >> 36;
|
||||
$y = ($hash >> 28) & Level::Y_MASK; //it's always positive
|
||||
$z = ($hash & 0xFFFFFFF) << 36 >> 36;
|
||||
}else{
|
||||
$hash = explode(":", $hash);
|
||||
$x = (int) $hash[0];
|
||||
$y = (int) $hash[1];
|
||||
$z = (int) $hash[2];
|
||||
}
|
||||
$x = $hash >> 36;
|
||||
$y = ($hash >> 28) & Level::Y_MASK; //it's always positive
|
||||
$z = ($hash & 0xFFFFFFF) << 36 >> 36;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -291,14 +284,8 @@ class Level implements ChunkManager, Metadatable{
|
||||
* @param int|null $z
|
||||
*/
|
||||
public static function getXZ($hash, &$x, &$z){
|
||||
if(PHP_INT_SIZE === 8){
|
||||
$x = $hash >> 32;
|
||||
$z = ($hash & 0xFFFFFFFF) << 32 >> 32;
|
||||
}else{
|
||||
$hash = explode(":", $hash);
|
||||
$x = (int) $hash[0];
|
||||
$z = (int) $hash[1];
|
||||
}
|
||||
$x = $hash >> 32;
|
||||
$z = ($hash & 0xFFFFFFFF) << 32 >> 32;
|
||||
}
|
||||
|
||||
public static function generateChunkLoaderId(ChunkLoader $loader) : int{
|
||||
|
Reference in New Issue
Block a user