mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Remove chunk order fields
This commit is contained in:
parent
18c0567944
commit
60260a294b
@ -698,7 +698,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
return $this->spawnPosition instanceof WeakPosition and $this->spawnPosition->isValid();
|
return $this->spawnPosition instanceof WeakPosition and $this->spawnPosition->isValid();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendChunk($x, $z, $payload, $ordering = FullChunkDataPacket::ORDER_COLUMNS){
|
public function sendChunk($x, $z, $payload){
|
||||||
if($this->connected === false){
|
if($this->connected === false){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -712,7 +712,6 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
$pk = new FullChunkDataPacket();
|
$pk = new FullChunkDataPacket();
|
||||||
$pk->chunkX = $x;
|
$pk->chunkX = $x;
|
||||||
$pk->chunkZ = $z;
|
$pk->chunkZ = $z;
|
||||||
$pk->order = $ordering;
|
|
||||||
$pk->data = $payload;
|
$pk->data = $payload;
|
||||||
$this->batchDataPacket($pk);
|
$this->batchDataPacket($pk);
|
||||||
}
|
}
|
||||||
@ -3569,15 +3568,13 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
* @param int $chunkX
|
* @param int $chunkX
|
||||||
* @param int $chunkZ
|
* @param int $chunkZ
|
||||||
* @param string $payload
|
* @param string $payload
|
||||||
* @param int $ordering
|
|
||||||
*
|
*
|
||||||
* @return DataPacket
|
* @return DataPacket
|
||||||
*/
|
*/
|
||||||
public static function getChunkCacheFromData($chunkX, $chunkZ, $payload, $ordering = FullChunkDataPacket::ORDER_COLUMNS){
|
public static function getChunkCacheFromData($chunkX, $chunkZ, $payload){
|
||||||
$pk = new FullChunkDataPacket();
|
$pk = new FullChunkDataPacket();
|
||||||
$pk->chunkX = $chunkX;
|
$pk->chunkX = $chunkX;
|
||||||
$pk->chunkZ = $chunkZ;
|
$pk->chunkZ = $chunkZ;
|
||||||
$pk->order = $ordering;
|
|
||||||
$pk->data = $payload;
|
$pk->data = $payload;
|
||||||
$pk->encode();
|
$pk->encode();
|
||||||
|
|
||||||
|
@ -2340,13 +2340,13 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function chunkRequestCallback(int $x, int $z, string $payload, int $ordering = FullChunkDataPacket::ORDER_COLUMNS){
|
public function chunkRequestCallback(int $x, int $z, string $payload){
|
||||||
$this->timings->syncChunkSendTimer->startTiming();
|
$this->timings->syncChunkSendTimer->startTiming();
|
||||||
|
|
||||||
$index = Level::chunkHash($x, $z);
|
$index = Level::chunkHash($x, $z);
|
||||||
|
|
||||||
if(!isset($this->chunkCache[$index]) and $this->cacheChunks and $this->server->getMemoryManager()->canUseChunkCache()){
|
if(!isset($this->chunkCache[$index]) and $this->cacheChunks and $this->server->getMemoryManager()->canUseChunkCache()){
|
||||||
$this->chunkCache[$index] = Player::getChunkCacheFromData($x, $z, $payload, $ordering);
|
$this->chunkCache[$index] = Player::getChunkCacheFromData($x, $z, $payload);
|
||||||
$this->sendChunkFromCache($x, $z);
|
$this->sendChunkFromCache($x, $z);
|
||||||
$this->timings->syncChunkSendTimer->stopTiming();
|
$this->timings->syncChunkSendTimer->stopTiming();
|
||||||
return;
|
return;
|
||||||
@ -2356,7 +2356,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
foreach($this->chunkSendQueue[$index] as $player){
|
foreach($this->chunkSendQueue[$index] as $player){
|
||||||
/** @var Player $player */
|
/** @var Player $player */
|
||||||
if($player->isConnected() and isset($player->usedChunks[$index])){
|
if($player->isConnected() and isset($player->usedChunks[$index])){
|
||||||
$player->sendChunk($x, $z, $payload, $ordering);
|
$player->sendChunk($x, $z, $payload);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($this->chunkSendQueue[$index]);
|
unset($this->chunkSendQueue[$index]);
|
||||||
|
@ -105,7 +105,7 @@ class Anvil extends McRegion{
|
|||||||
$extraData->getBuffer() .
|
$extraData->getBuffer() .
|
||||||
$tiles;
|
$tiles;
|
||||||
|
|
||||||
$this->getLevel()->chunkRequestCallback($x, $z, $ordered, FullChunkDataPacket::ORDER_LAYERED);
|
$this->getLevel()->chunkRequestCallback($x, $z, $ordered);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -27,12 +27,8 @@ namespace pocketmine\network\protocol;
|
|||||||
class FullChunkDataPacket extends DataPacket{
|
class FullChunkDataPacket extends DataPacket{
|
||||||
const NETWORK_ID = Info::FULL_CHUNK_DATA_PACKET;
|
const NETWORK_ID = Info::FULL_CHUNK_DATA_PACKET;
|
||||||
|
|
||||||
const ORDER_COLUMNS = 0;
|
|
||||||
const ORDER_LAYERED = 1;
|
|
||||||
|
|
||||||
public $chunkX;
|
public $chunkX;
|
||||||
public $chunkZ;
|
public $chunkZ;
|
||||||
public $order = self::ORDER_COLUMNS;
|
|
||||||
public $data;
|
public $data;
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
@ -43,7 +39,6 @@ class FullChunkDataPacket extends DataPacket{
|
|||||||
$this->reset();
|
$this->reset();
|
||||||
$this->putVarInt($this->chunkX);
|
$this->putVarInt($this->chunkX);
|
||||||
$this->putVarInt($this->chunkZ);
|
$this->putVarInt($this->chunkZ);
|
||||||
$this->putByte($this->order);
|
|
||||||
$this->putString($this->data);
|
$this->putString($this->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user