diff --git a/composer.lock b/composer.lock index 070d740e0..25003db99 100644 --- a/composer.lock +++ b/composer.lock @@ -48,16 +48,16 @@ }, { "name": "pocketmine/binaryutils", - "version": "0.1.1", + "version": "0.1.2", "source": { "type": "git", "url": "https://github.com/pmmp/BinaryUtils.git", - "reference": "54efeb978be0ff9335022729fe63c1e2077bf1be" + "reference": "2c1628f08a9cdeca4d3c682e13f24420944ca845" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/BinaryUtils/zipball/54efeb978be0ff9335022729fe63c1e2077bf1be", - "reference": "54efeb978be0ff9335022729fe63c1e2077bf1be", + "url": "https://api.github.com/repos/pmmp/BinaryUtils/zipball/2c1628f08a9cdeca4d3c682e13f24420944ca845", + "reference": "2c1628f08a9cdeca4d3c682e13f24420944ca845", "shasum": "" }, "require": { @@ -75,10 +75,10 @@ ], "description": "Classes and methods for conveniently handling binary data", "support": { - "source": "https://github.com/pmmp/BinaryUtils/tree/master", + "source": "https://github.com/pmmp/BinaryUtils/tree/0.1.2", "issues": "https://github.com/pmmp/BinaryUtils/issues" }, - "time": "2018-08-26T18:11:05+00:00" + "time": "2018-12-22T12:29:30+00:00" }, { "name": "pocketmine/math", diff --git a/src/pocketmine/entity/Attribute.php b/src/pocketmine/entity/Attribute.php index 15b2664a1..795e908d5 100644 --- a/src/pocketmine/entity/Attribute.php +++ b/src/pocketmine/entity/Attribute.php @@ -171,7 +171,7 @@ class Attribute{ } public function resetToDefault() : void{ - $this->setValue($this->getDefaultValue()); + $this->setValue($this->getDefaultValue(), true); } public function getValue() : float{ diff --git a/src/pocketmine/level/format/io/leveldb/LevelDB.php b/src/pocketmine/level/format/io/leveldb/LevelDB.php index 725c572ff..6cb56b238 100644 --- a/src/pocketmine/level/format/io/leveldb/LevelDB.php +++ b/src/pocketmine/level/format/io/leveldb/LevelDB.php @@ -283,6 +283,11 @@ class LevelDB extends BaseLevelProvider{ /** @var SubChunk[] $subChunks */ $subChunks = []; + /** @var int[] $heightMap */ + $heightMap = []; + /** @var string $biomeIds */ + $biomeIds = ""; + /** @var bool $lightPopulated */ $lightPopulated = true; @@ -325,10 +330,12 @@ class LevelDB extends BaseLevelProvider{ } } - $binaryStream->setBuffer($this->db->get($index . self::TAG_DATA_2D), 0); + if(($maps2d = $this->db->get($index . self::TAG_DATA_2D)) !== false){ + $binaryStream->setBuffer($maps2d, 0); - $heightMap = array_values(unpack("v*", $binaryStream->get(512))); - $biomeIds = $binaryStream->get(256); + $heightMap = array_values(unpack("v*", $binaryStream->get(512))); + $biomeIds = $binaryStream->get(256); + } break; case 2: // < MCPE 1.0 $binaryStream->setBuffer($this->db->get($index . self::TAG_LEGACY_TERRAIN)); diff --git a/src/pocketmine/utils/Utils.php b/src/pocketmine/utils/Utils.php index 076c6222b..23b3a0af9 100644 --- a/src/pocketmine/utils/Utils.php +++ b/src/pocketmine/utils/Utils.php @@ -313,8 +313,8 @@ class Utils{ ++$processors; } } - }else{ - if(preg_match("/^([0-9]+)\\-([0-9]+)$/", trim(@file_get_contents("/sys/devices/system/cpu/present")), $matches) > 0){ + }elseif(is_readable("/sys/devices/system/cpu/present")){ + if(preg_match("/^([0-9]+)\\-([0-9]+)$/", trim(file_get_contents("/sys/devices/system/cpu/present")), $matches) > 0){ $processors = (int) ($matches[2] - $matches[1]); } }