mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
bonemeal on sugarcane tweaks, using block send queue to send UpdateBlockPackets
This commit is contained in:
parent
7ecfcacec6
commit
229a563ff5
8 changed files with 84 additions and 70 deletions
|
|
@ -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];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue