mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +00:00
protocol: fixed byte pitch/yaw
This commit is contained in:
parent
dbaa8a659f
commit
19780937c2
3 changed files with 14 additions and 4 deletions
|
|
@ -457,6 +457,16 @@ class Utils{
|
|||
return substr(pack("N", $value), 1);
|
||||
}
|
||||
|
||||
public static function rotDegreesToChar(float $deg) : int{
|
||||
return ((int)(($deg / 360.0) * 256.0)) & 0xFF;
|
||||
}
|
||||
|
||||
public static function rotCharToDegrees(int $char) : float{
|
||||
$char = $char & 0xFF;
|
||||
if($char >= 128) $char -= 256;
|
||||
return $char * 360.0 / 256.0;
|
||||
}
|
||||
|
||||
public static function getRandomBytes($length = 16, $secure = true, $raw = true, $startEntropy = "", &$rounds = 0, &$drop = 0){
|
||||
return $raw ? random_bytes($length) : bin2hex(random_bytes($length)); //nobody would ever notice other parameters
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue