mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 09:19:42 +00:00
Updated references and submodules
This commit is contained in:
parent
c2f72ea9ac
commit
094234dc0f
@ -592,7 +592,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
$pk = new FullChunkDataPacket();
|
||||
$pk->chunkX = $x;
|
||||
$pk->chunkZ = $z;
|
||||
$pk->data =& $payload;
|
||||
$pk->data = $payload;
|
||||
$this->batchDataPacket($pk->setChannel(Network::CHANNEL_WORLD_CHUNKS));
|
||||
|
||||
if($this->spawned){
|
||||
|
@ -288,29 +288,29 @@ interface FullChunk{
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function &getBiomeIdArray();
|
||||
public function getBiomeIdArray();
|
||||
|
||||
/**
|
||||
* @return int[]
|
||||
*/
|
||||
public function &getBiomeColorArray();
|
||||
public function getBiomeColorArray();
|
||||
|
||||
/**
|
||||
* @return int[]
|
||||
*/
|
||||
public function &getHeightMapArray();
|
||||
public function getHeightMapArray();
|
||||
|
||||
public function &getBlockIdArray();
|
||||
public function getBlockIdArray();
|
||||
|
||||
public function &getBlockDataArray();
|
||||
public function getBlockDataArray();
|
||||
|
||||
public function &getBlockSkyLightArray();
|
||||
public function getBlockSkyLightArray();
|
||||
|
||||
public function &getBlockLightArray();
|
||||
public function getBlockLightArray();
|
||||
|
||||
public function &toBinary();
|
||||
public function toBinary();
|
||||
|
||||
public function &toFastBinary();
|
||||
public function toFastBinary();
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
@ -328,7 +328,7 @@ interface FullChunk{
|
||||
*
|
||||
* @return FullChunk
|
||||
*/
|
||||
public static function fromBinary(&$data, LevelProvider $provider = null);
|
||||
public static function fromBinary($data, LevelProvider $provider = null);
|
||||
|
||||
/**
|
||||
* @param string $data
|
||||
@ -336,6 +336,6 @@ interface FullChunk{
|
||||
*
|
||||
* @return FullChunk
|
||||
*/
|
||||
public static function fromFastBinary(&$data, LevelProvider $provider = null);
|
||||
public static function fromFastBinary($data, LevelProvider $provider = null);
|
||||
|
||||
}
|
@ -135,7 +135,7 @@ class Chunk extends BaseChunk{
|
||||
*
|
||||
* @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{
|
||||
@ -152,7 +152,7 @@ class Chunk extends BaseChunk{
|
||||
}
|
||||
}
|
||||
|
||||
public function &toBinary(){
|
||||
public function toBinary(){
|
||||
$nbt = clone $this->getNBT();
|
||||
|
||||
$nbt->xPos = new Int("xPos", $this->x);
|
||||
|
@ -133,8 +133,7 @@ class ChunkRequestTask extends AsyncTask{
|
||||
public function onCompletion(Server $server){
|
||||
$level = $server->getLevel($this->levelId);
|
||||
if($level instanceof Level and $this->hasResult()){
|
||||
$result = $this->getResult();
|
||||
$level->chunkRequestCallback($this->chunkX, $this->chunkZ, $result);
|
||||
$level->chunkRequestCallback($this->chunkX, $this->chunkZ, $this->getResult());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ class ChunkSection implements \pocketmine\level\format\ChunkSection{
|
||||
}
|
||||
}
|
||||
|
||||
public function &getBlockIdColumn($x, $z){
|
||||
public function getBlockIdColumn($x, $z){
|
||||
$i = ($z << 4) + $x;
|
||||
$column = "";
|
||||
for($y = 0; $y < 16; ++$y){
|
||||
@ -165,7 +165,7 @@ class ChunkSection implements \pocketmine\level\format\ChunkSection{
|
||||
return $column;
|
||||
}
|
||||
|
||||
public function &getBlockDataColumn($x, $z){
|
||||
public function getBlockDataColumn($x, $z){
|
||||
$i = ($z << 3) + ($x >> 1);
|
||||
$column = "";
|
||||
if(($x & 1) === 0){
|
||||
@ -181,7 +181,7 @@ class ChunkSection implements \pocketmine\level\format\ChunkSection{
|
||||
return $column;
|
||||
}
|
||||
|
||||
public function &getBlockSkyLightColumn($x, $z){
|
||||
public function getBlockSkyLightColumn($x, $z){
|
||||
$i = ($z << 3) + ($x >> 1);
|
||||
$column = "";
|
||||
if(($x & 1) === 0){
|
||||
@ -197,7 +197,7 @@ class ChunkSection implements \pocketmine\level\format\ChunkSection{
|
||||
return $column;
|
||||
}
|
||||
|
||||
public function &getBlockLightColumn($x, $z){
|
||||
public function getBlockLightColumn($x, $z){
|
||||
$i = ($z << 3) + ($x >> 1);
|
||||
$column = "";
|
||||
if(($x & 1) === 0){
|
||||
@ -213,19 +213,19 @@ class ChunkSection implements \pocketmine\level\format\ChunkSection{
|
||||
return $column;
|
||||
}
|
||||
|
||||
public function &getIdArray(){
|
||||
public function getIdArray(){
|
||||
return $this->blocks;
|
||||
}
|
||||
|
||||
public function &getDataArray(){
|
||||
public function getDataArray(){
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function &getSkyLightArray(){
|
||||
public function getSkyLightArray(){
|
||||
return $this->skyLight;
|
||||
}
|
||||
|
||||
public function &getLightArray(){
|
||||
public function getLightArray(){
|
||||
return $this->blockLight;
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ abstract class BaseChunk extends BaseFullChunk implements Chunk{
|
||||
}
|
||||
}
|
||||
|
||||
public function &getBlockIdColumn($x, $z){
|
||||
public function getBlockIdColumn($x, $z){
|
||||
$column = "";
|
||||
for($y = 0; $y < Chunk::SECTION_COUNT; ++$y){
|
||||
$column .= $this->sections[$y]->getBlockIdColumn($x, $z);
|
||||
@ -174,7 +174,7 @@ abstract class BaseChunk extends BaseFullChunk implements Chunk{
|
||||
return $column;
|
||||
}
|
||||
|
||||
public function &getBlockDataColumn($x, $z){
|
||||
public function getBlockDataColumn($x, $z){
|
||||
$column = "";
|
||||
for($y = 0; $y < Chunk::SECTION_COUNT; ++$y){
|
||||
$column .= $this->sections[$y]->getBlockDataColumn($x, $z);
|
||||
@ -183,7 +183,7 @@ abstract class BaseChunk extends BaseFullChunk implements Chunk{
|
||||
return $column;
|
||||
}
|
||||
|
||||
public function &getBlockSkyLightColumn($x, $z){
|
||||
public function getBlockSkyLightColumn($x, $z){
|
||||
$column = "";
|
||||
for($y = 0; $y < Chunk::SECTION_COUNT; ++$y){
|
||||
$column .= $this->sections[$y]->getBlockSkyLightColumn($x, $z);
|
||||
@ -192,7 +192,7 @@ abstract class BaseChunk extends BaseFullChunk implements Chunk{
|
||||
return $column;
|
||||
}
|
||||
|
||||
public function &getBlockLightColumn($x, $z){
|
||||
public function getBlockLightColumn($x, $z){
|
||||
$column = "";
|
||||
for($y = 0; $y < Chunk::SECTION_COUNT; ++$y){
|
||||
$column .= $this->sections[$y]->getBlockLightColumn($x, $z);
|
||||
@ -227,7 +227,7 @@ abstract class BaseChunk extends BaseFullChunk implements Chunk{
|
||||
return $this->getProvider() === null ? false : $this->getProvider()->getChunk($this->getX(), $this->getZ(), true) instanceof Chunk;
|
||||
}
|
||||
|
||||
public function &getBlockIdArray(){
|
||||
public function getBlockIdArray(){
|
||||
$blocks = "";
|
||||
for($y = 0; $y < Chunk::SECTION_COUNT; ++$y){
|
||||
$blocks .= $this->sections[$y]->getIdArray();
|
||||
@ -236,7 +236,7 @@ abstract class BaseChunk extends BaseFullChunk implements Chunk{
|
||||
return $blocks;
|
||||
}
|
||||
|
||||
public function &getBlockDataArray(){
|
||||
public function getBlockDataArray(){
|
||||
$data = "";
|
||||
for($y = 0; $y < Chunk::SECTION_COUNT; ++$y){
|
||||
$data .= $this->sections[$y]->getDataArray();
|
||||
@ -245,7 +245,7 @@ abstract class BaseChunk extends BaseFullChunk implements Chunk{
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function &getBlockSkyLightArray(){
|
||||
public function getBlockSkyLightArray(){
|
||||
$skyLight = "";
|
||||
for($y = 0; $y < Chunk::SECTION_COUNT; ++$y){
|
||||
$skyLight .= $this->sections[$y]->getSkyLightArray();
|
||||
@ -254,7 +254,7 @@ abstract class BaseChunk extends BaseFullChunk implements Chunk{
|
||||
return $skyLight;
|
||||
}
|
||||
|
||||
public function &getBlockLightArray(){
|
||||
public function getBlockLightArray(){
|
||||
$blockLight = "";
|
||||
for($y = 0; $y < Chunk::SECTION_COUNT; ++$y){
|
||||
$blockLight .= $this->sections[$y]->getLightArray();
|
||||
|
@ -82,18 +82,18 @@ abstract class BaseFullChunk implements FullChunk{
|
||||
* @param Compound[] $entities
|
||||
* @param Compound[] $tiles
|
||||
*/
|
||||
protected function __construct($provider, $x, $z, &$blocks, &$data, &$skyLight, &$blockLight, &$biomeIds = null, array $biomeColors = [], array $heightMap = [], array $entities = [], array $tiles = []){
|
||||
protected function __construct($provider, $x, $z, $blocks, $data, $skyLight, $blockLight, $biomeIds = null, array $biomeColors = [], array $heightMap = [], array $entities = [], array $tiles = []){
|
||||
$this->provider = $provider;
|
||||
$this->x = (int) $x;
|
||||
$this->z = (int) $z;
|
||||
|
||||
$this->blocks =& $blocks;
|
||||
$this->data =& $data;
|
||||
$this->skyLight =& $skyLight;
|
||||
$this->blockLight =& $blockLight;
|
||||
$this->blocks = $blocks;
|
||||
$this->data = $data;
|
||||
$this->skyLight = $skyLight;
|
||||
$this->blockLight = $blockLight;
|
||||
|
||||
if(strlen($biomeIds) === 256){
|
||||
$this->biomeIds =& $biomeIds;
|
||||
$this->biomeIds = $biomeIds;
|
||||
}else{
|
||||
$this->biomeIds = str_repeat("\x01", 256);
|
||||
}
|
||||
@ -321,31 +321,31 @@ abstract class BaseFullChunk implements FullChunk{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function &getBlockIdArray(){
|
||||
public function getBlockIdArray(){
|
||||
return $this->blocks;
|
||||
}
|
||||
|
||||
public function &getBlockDataArray(){
|
||||
public function getBlockDataArray(){
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function &getBlockSkyLightArray(){
|
||||
public function getBlockSkyLightArray(){
|
||||
return $this->skyLight;
|
||||
}
|
||||
|
||||
public function &getBlockLightArray(){
|
||||
public function getBlockLightArray(){
|
||||
return $this->blockLight;
|
||||
}
|
||||
|
||||
public function &getBiomeIdArray(){
|
||||
public function getBiomeIdArray(){
|
||||
return $this->biomeIds;
|
||||
}
|
||||
|
||||
public function &getBiomeColorArray(){
|
||||
public function getBiomeColorArray(){
|
||||
return $this->biomeColors;
|
||||
}
|
||||
|
||||
public function &getHeightMapArray(){
|
||||
public function getHeightMapArray(){
|
||||
return $this->heightMap;
|
||||
}
|
||||
|
||||
@ -357,11 +357,11 @@ abstract class BaseFullChunk implements FullChunk{
|
||||
$this->hasChanged = (bool) $changed;
|
||||
}
|
||||
|
||||
public static function fromFastBinary(&$data, LevelProvider $provider = null){
|
||||
public static function fromFastBinary($data, LevelProvider $provider = null){
|
||||
return static::fromBinary($data, $provider);
|
||||
}
|
||||
|
||||
public function &toFastBinary(){
|
||||
public function toFastBinary(){
|
||||
return $this->toBinary();
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ class Chunk extends BaseFullChunk{
|
||||
protected $isPopulated = false;
|
||||
protected $isGenerated = false;
|
||||
|
||||
public function __construct($level, $chunkX, $chunkZ, &$terrain, array $entityData = null, array $tileData = null){
|
||||
public function __construct($level, $chunkX, $chunkZ, $terrain, array $entityData = null, array $tileData = null){
|
||||
$heightMap = array_fill(0, 256, 127);
|
||||
|
||||
$offset = 0;
|
||||
@ -221,7 +221,7 @@ class Chunk extends BaseFullChunk{
|
||||
$this->isGenerated = (bool) $value;
|
||||
}
|
||||
|
||||
public static function fromFastBinary(&$data, LevelProvider $provider = null){
|
||||
public static function fromFastBinary($data, LevelProvider $provider = null){
|
||||
return self::fromBinary($data, $provider);
|
||||
}
|
||||
|
||||
@ -231,7 +231,7 @@ class Chunk extends BaseFullChunk{
|
||||
*
|
||||
* @return Chunk
|
||||
*/
|
||||
public static function fromBinary(&$data, LevelProvider $provider = null){
|
||||
public static function fromBinary($data, LevelProvider $provider = null){
|
||||
try{
|
||||
$chunkX = Binary::readLInt(substr($data, 0, 4));
|
||||
$chunkZ = Binary::readLInt(substr($data, 4, 4));
|
||||
|
@ -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,7 +340,7 @@ class Chunk extends BaseFullChunk{
|
||||
}
|
||||
}
|
||||
|
||||
public function &toFastBinary(){
|
||||
public function toFastBinary(){
|
||||
$biomeColors = pack("N*", ...$this->getBiomeColorArray());
|
||||
$heightMap = pack("N*", ...$this->getHeightMapArray());
|
||||
|
||||
@ -358,7 +358,7 @@ class Chunk extends BaseFullChunk{
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function &toBinary(){
|
||||
public function toBinary(){
|
||||
$nbt = clone $this->getNBT();
|
||||
|
||||
$nbt->xPos = new Int("xPos", $this->x);
|
||||
@ -401,8 +401,7 @@ class Chunk extends BaseFullChunk{
|
||||
$nbt->setName("Level");
|
||||
$writer->setData(new Compound("", ["Level" => $nbt]));
|
||||
|
||||
$data =& $writer->writeCompressed(ZLIB_ENCODING_DEFLATE, RegionLoader::$COMPRESSION_LEVEL);
|
||||
return $data;
|
||||
return $writer->writeCompressed(ZLIB_ENCODING_DEFLATE, RegionLoader::$COMPRESSION_LEVEL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -185,7 +185,7 @@ class RegionLoader{
|
||||
}
|
||||
}
|
||||
|
||||
protected function saveChunk($x, $z, &$chunkData){
|
||||
protected function saveChunk($x, $z, $chunkData){
|
||||
$length = strlen($chunkData) + 1;
|
||||
if($length + 4 > self::MAX_SECTOR_LENGTH){
|
||||
throw new ChunkException("Chunk is too big! ".($length + 4)." > ".self::MAX_SECTOR_LENGTH);
|
||||
@ -212,7 +212,7 @@ class RegionLoader{
|
||||
|
||||
public function writeChunk(FullChunk $chunk){
|
||||
$this->lastUsed = time();
|
||||
$chunkData = &$chunk->toBinary();
|
||||
$chunkData = $chunk->toBinary();
|
||||
if($chunkData !== false){
|
||||
$this->saveChunk($chunk->getX() - ($this->getX() * 32), $chunk->getZ() - ($this->getZ() * 32), $chunkData);
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ class NBT{
|
||||
return $len === 1 ? $this->buffer{$this->offset++} : substr($this->buffer, ($this->offset += $len) - $len, $len);
|
||||
}
|
||||
|
||||
public function put(&$v){
|
||||
public function put($v){
|
||||
$this->buffer .= $v;
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ class NBT{
|
||||
|
||||
public function read($buffer, $doMultiple = false){
|
||||
$this->offset = 0;
|
||||
$this->buffer =& $buffer;
|
||||
$this->buffer = $buffer;
|
||||
$this->data = $this->readTag();
|
||||
if($doMultiple and $this->offset < strlen($this->buffer)){
|
||||
$this->data = [$this->data];
|
||||
@ -117,24 +117,24 @@ class NBT{
|
||||
/**
|
||||
* @return string|bool
|
||||
*/
|
||||
public function &write(){
|
||||
public function write(){
|
||||
$this->offset = 0;
|
||||
$data = false;
|
||||
if($this->data instanceof Compound){
|
||||
$this->writeTag($this->data);
|
||||
|
||||
$data =& $this->buffer;
|
||||
$data = $this->buffer;
|
||||
}elseif(is_array($this->data)){
|
||||
foreach($this->data as $tag){
|
||||
$this->writeTag($tag);
|
||||
}
|
||||
$data =& $this->buffer;
|
||||
$data = $this->buffer;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function &writeCompressed($compression = ZLIB_ENCODING_GZIP, $level = 7){
|
||||
public function writeCompressed($compression = ZLIB_ENCODING_GZIP, $level = 7){
|
||||
$data = false;
|
||||
if(($write = $this->write()) !== false){
|
||||
$data = zlib_encode($write, $compression, $level);
|
||||
@ -258,7 +258,7 @@ class NBT{
|
||||
return $this->get($this->getShort());
|
||||
}
|
||||
|
||||
public function putString(&$v){
|
||||
public function putString($v){
|
||||
$this->putShort(strlen($v));
|
||||
$this->buffer .= $v;
|
||||
}
|
||||
|
@ -27,13 +27,6 @@ use pocketmine\nbt\NBT;
|
||||
|
||||
class ByteArray extends NamedTag{
|
||||
|
||||
public function __construct($name = "", &$value = null){
|
||||
$this->name = $name;
|
||||
if($value !== null){
|
||||
$this->value =& $value;
|
||||
}
|
||||
}
|
||||
|
||||
public function getType(){
|
||||
return NBT::TAG_ByteArray;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ abstract class NamedTag extends Tag{
|
||||
}
|
||||
}
|
||||
|
||||
public function &getName(){
|
||||
public function getName(){
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ class String extends NamedTag{
|
||||
public function __construct($name = "", $value = null){
|
||||
$this->name = $name;
|
||||
if($value !== null){
|
||||
$this->value =& $value;
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ class CompressBatchedTask extends AsyncTask{
|
||||
public $channel = 0;
|
||||
public $targets = [];
|
||||
|
||||
public function __construct(&$data, array $targets, $level = 7, $channel = 0){
|
||||
public function __construct($data, array $targets, $level = 7, $channel = 0){
|
||||
$this->data = $data;
|
||||
$this->targets = $targets;
|
||||
$this->level = $level;
|
||||
|
@ -248,7 +248,7 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
|
||||
return null;
|
||||
}
|
||||
|
||||
private function getPacket(&$buffer){
|
||||
private function getPacket($buffer){
|
||||
$pid = ord($buffer{0});
|
||||
|
||||
if(($data = $this->network->getPacket($pid)) === null){
|
||||
|
@ -57,8 +57,8 @@ abstract class DataPacket extends \stdClass{
|
||||
return $this->channel;
|
||||
}
|
||||
|
||||
public function setBuffer(&$buffer = null, $offset = 0){
|
||||
$this->buffer =& $buffer;
|
||||
public function setBuffer($buffer = null, $offset = 0){
|
||||
$this->buffer = $buffer;
|
||||
$this->offset = (int) $offset;
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ abstract class DataPacket extends \stdClass{
|
||||
return $this->offset;
|
||||
}
|
||||
|
||||
public function &getBuffer(){
|
||||
public function getBuffer(){
|
||||
return $this->buffer;
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ abstract class DataPacket extends \stdClass{
|
||||
return $len === 1 ? $this->buffer{$this->offset++} : substr($this->buffer, ($this->offset += $len) - $len, $len);
|
||||
}
|
||||
|
||||
protected function put(&$str){
|
||||
protected function put($str){
|
||||
$this->buffer .= $str;
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ abstract class DataPacket extends \stdClass{
|
||||
return $this->get($this->getShort());
|
||||
}
|
||||
|
||||
protected function putString(&$v){
|
||||
protected function putString($v){
|
||||
$this->putShort(strlen($v));
|
||||
$this->put($v);
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 424faed1dc78564222301a56811bd6394b6c74a0
|
||||
Subproject commit caa379e570dca9382d9619843ef93d753267cafa
|
2
src/spl
2
src/spl
@ -1 +1 @@
|
||||
Subproject commit 3db41e1266811b20c3f52f749265f6c9d416c1bb
|
||||
Subproject commit c6763e38dc3da4db13bea176e05564c04cfb5e98
|
Loading…
x
Reference in New Issue
Block a user