mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
Added MemoryManager, new memory properties, improved performance, updated RakLib, fixed misc. bugs
This commit is contained in:
@ -276,7 +276,7 @@ class Chunk extends BaseFullChunk{
|
||||
*
|
||||
* @return Chunk
|
||||
*/
|
||||
public static function fromBinary($data, LevelProvider $provider = null){
|
||||
public static function fromBinary(&$data, LevelProvider $provider = null){
|
||||
$nbt = new NBT(NBT::BIG_ENDIAN);
|
||||
|
||||
try{
|
||||
@ -293,7 +293,7 @@ class Chunk extends BaseFullChunk{
|
||||
}
|
||||
}
|
||||
|
||||
public static function fromFastBinary($data, LevelProvider $provider = null){
|
||||
public static function fromFastBinary(&$data, LevelProvider $provider = null){
|
||||
|
||||
try{
|
||||
$offset = 0;
|
||||
@ -340,11 +340,11 @@ class Chunk extends BaseFullChunk{
|
||||
}
|
||||
}
|
||||
|
||||
public function toFastBinary(){
|
||||
public function &toFastBinary(){
|
||||
$biomeColors = pack("N*", ...$this->getBiomeColorArray());
|
||||
$heightMap = pack("N*", ...$this->getHeightMapArray());
|
||||
|
||||
return
|
||||
$data =
|
||||
Binary::writeInt($this->x) .
|
||||
Binary::writeInt($this->z) .
|
||||
$this->getBlockIdArray() .
|
||||
@ -355,9 +355,10 @@ class Chunk extends BaseFullChunk{
|
||||
$biomeColors .
|
||||
$heightMap .
|
||||
chr(($this->isPopulated() ? 1 << 1 : 0) + ($this->isGenerated() ? 1 : 0));
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function toBinary(){
|
||||
public function &toBinary(){
|
||||
$nbt = clone $this->getNBT();
|
||||
|
||||
$nbt->xPos = new Int("xPos", $this->x);
|
||||
@ -400,7 +401,8 @@ class Chunk extends BaseFullChunk{
|
||||
$nbt->setName("Level");
|
||||
$writer->setData(new Compound("", ["Level" => $nbt]));
|
||||
|
||||
return $writer->writeCompressed(ZLIB_ENCODING_DEFLATE, RegionLoader::$COMPRESSION_LEVEL);
|
||||
$data =& $writer->writeCompressed(ZLIB_ENCODING_DEFLATE, RegionLoader::$COMPRESSION_LEVEL);
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user