bonemeal on sugarcane tweaks, using block send queue to send UpdateBlockPackets

This commit is contained in:
GameHerobrine 2023-12-31 17:42:59 +03:00
parent 7ecfcacec6
commit 229a563ff5
8 changed files with 84 additions and 70 deletions

View file

@ -80,6 +80,9 @@ class Utils{
return floor(($v % 360 + 360) % 360);
}
/**
* PHP8 has internal function for doing it: {@link str_ends_with}
*/
public static function endsWith($str, $check) {
return substr($str, -strlen($check)) === $check;
}
@ -100,26 +103,6 @@ class Utils{
return $num >= $min && $num <= $max;
}
public function xrange($start, $limit, $step = 1) {
if ($start <= $limit) {
if ($step <= 0) {
throw new LogicException('Step must be positive');
}
for ($i = $start; $i <= $limit; $i += $step) {
yield $i;
}
} else {
if ($step >= 0) {
throw new LogicException('Step must be negative');
}
for ($i = $start; $i >= $limit; $i += $step) {
yield $i;
}
}
}
public static function getUniqueID($raw = false, $extra = ""){
$machine = php_uname("a");
$machine .= file_exists("/proc/cpuinfo") ? `cat /proc/cpuinfo | grep "model name"` : "";
@ -463,10 +446,6 @@ class Utils{
return $data;
}
public static function php8_nulcoal(&$arr, $else){
return isset($arr) ? $arr : $else;
}
public static function readTriad($str){
return @unpack("N", "\x00" . $str)[1];
}