mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 02:38:54 +00:00
Fixed issues with CPU loop
This commit is contained in:
parent
e033af0e72
commit
18117b91ed
@ -116,7 +116,7 @@ namespace PocketMine {
|
||||
$opts = getopt("", array("enable-ansi", "disable-ansi", "data-path:", "no-wizard"));
|
||||
define("PocketMine\\DATA", isset($opts["data-path"]) ? realpath($opts["data-path"]) . DIRECTORY_SEPARATOR : \PocketMine\PATH);
|
||||
|
||||
if((strpos(strtoupper(php_uname("s")), "WIN") or isset($opts["enable-ansi"])) and !isset($opts["disable-ansi"])){
|
||||
if((!strpos(strtoupper(php_uname("s")), "WIN") or isset($opts["enable-ansi"])) and !isset($opts["disable-ansi"])){
|
||||
define("PocketMine\\ANSI", true);
|
||||
} else{
|
||||
define("PocketMine\\ANSI", false);
|
||||
|
@ -588,18 +588,16 @@ class Server{
|
||||
$this->packetHandler($packet);
|
||||
$lastLoop = 0;
|
||||
}
|
||||
if($this->tick() > 0){
|
||||
$lastLoop = 0;
|
||||
} else{
|
||||
if(($ticks = $this->tick()) === 0){
|
||||
++$lastLoop;
|
||||
if($lastLoop < 64){
|
||||
|
||||
if($lastLoop < 16){
|
||||
usleep(1);
|
||||
} elseif($lastLoop < 128){
|
||||
usleep(1000);
|
||||
} elseif($lastLoop < 256){
|
||||
usleep(100);
|
||||
} elseif($lastLoop < 512){
|
||||
usleep(512);
|
||||
usleep(2000);
|
||||
} else{
|
||||
usleep(5000);
|
||||
usleep(4000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
namespace PocketMine;
|
||||
|
||||
use PocketMine\Level;
|
||||
|
||||
class TimeAPI{
|
||||
public static $phases = array(
|
||||
"day" => 0,
|
||||
|
@ -262,7 +262,7 @@ abstract class Block extends Position{
|
||||
self::DANDELION => new Dandelion(),
|
||||
self::CYAN_FLOWER => new CyanFlower(),
|
||||
self::BROWN_MUSHROOM => new BrownMushroom(),
|
||||
self::RED_MUSHROOM => new RedMushRoom(),
|
||||
self::RED_MUSHROOM => new RedMushroom(),
|
||||
self::GOLD_BLOCK => new Gold(),
|
||||
self::IRON_BLOCK => new Iron(),
|
||||
self::DOUBLE_SLAB => new DoubleSlab(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user