mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
fixing chunk sending
This commit is contained in:
parent
b766b969e2
commit
e11b76318c
@ -101,6 +101,7 @@ use pocketmine\nbt\tag\StringTag;
|
||||
use pocketmine\network\protocol\AdventureSettingsPacket;
|
||||
use pocketmine\network\protocol\AnimatePacket;
|
||||
use pocketmine\network\protocol\BatchPacket;
|
||||
use pocketmine\network\protocol\ChunkRadiusUpdatePacket;
|
||||
use pocketmine\network\protocol\ContainerClosePacket;
|
||||
use pocketmine\network\protocol\ContainerSetContentPacket;
|
||||
use pocketmine\network\protocol\DataPacket;
|
||||
@ -2874,6 +2875,14 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ProtocolInfo::REQUEST_CHUNK_RADIUS_PACKET:
|
||||
if($this->spawned){
|
||||
$this->viewDistance = $packet->radius ** 2;
|
||||
}
|
||||
$pk = new ChunkRadiusUpdatePacket();
|
||||
$pk->radius = $packet->radius;
|
||||
$this->dataPacket($pk);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ use pocketmine\network\protocol\AddPlayerPacket;
|
||||
use pocketmine\network\protocol\AdventureSettingsPacket;
|
||||
use pocketmine\network\protocol\AnimatePacket;
|
||||
use pocketmine\network\protocol\BatchPacket;
|
||||
use pocketmine\network\protocol\ChunkRadiusUpdatePacket;
|
||||
use pocketmine\network\protocol\ContainerClosePacket;
|
||||
use pocketmine\network\protocol\ContainerOpenPacket;
|
||||
use pocketmine\network\protocol\ContainerSetContentPacket;
|
||||
@ -42,6 +43,7 @@ use pocketmine\network\protocol\DataPacket;
|
||||
use pocketmine\network\protocol\DropItemPacket;
|
||||
use pocketmine\network\protocol\FullChunkDataPacket;
|
||||
use pocketmine\network\protocol\Info;
|
||||
use pocketmine\network\protocol\RequestChunkRadiusPacket;
|
||||
use pocketmine\network\protocol\SetEntityLinkPacket;
|
||||
use pocketmine\network\protocol\BlockEntityDataPacket;
|
||||
use pocketmine\network\protocol\EntityEventPacket;
|
||||
@ -332,5 +334,7 @@ class Network{
|
||||
$this->registerPacket(ProtocolInfo::SET_DIFFICULTY_PACKET, SetDifficultyPacket::class);
|
||||
$this->registerPacket(ProtocolInfo::SET_PLAYER_GAMETYPE_PACKET, SetPlayerGameTypePacket::class);
|
||||
$this->registerPacket(ProtocolInfo::PLAYER_LIST_PACKET, PlayerListPacket::class);
|
||||
$this->registerPacket(ProtocolInfo::REQUEST_CHUNK_RADIUS_PACKET, RequestChunkRadiusPacket::class);
|
||||
$this->registerPacket(ProtocolInfo::CHUNK_RADIUS_UPDATE_PACKET, ChunkRadiusUpdatePacket::class);
|
||||
}
|
||||
}
|
||||
|
40
src/pocketmine/network/protocol/ChunkRadiusUpdatePacket.php
Normal file
40
src/pocketmine/network/protocol/ChunkRadiusUpdatePacket.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace pocketmine\network\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
|
||||
class ChunkRadiusUpdatePacket extends DataPacket{
|
||||
const NETWORK_ID = Info::CHUNK_RADIUS_UPDATE_PACKET;
|
||||
|
||||
public $radius;
|
||||
|
||||
public function decode(){
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putInt($this->radius);
|
||||
}
|
||||
|
||||
}
|
@ -89,8 +89,8 @@ interface Info{
|
||||
// const SPAWN_EXPERIENCE_ORB_PACKET = 0xc5
|
||||
// const CLIENTBOUND_MAP_ITEM_DATA_PACKET = 0xc6;
|
||||
// const MAP_INFO_REQUEST_PACKET = 0xc7;
|
||||
// const REQUEST_CHUNK_RADIUS_PACKET = 0xc8;
|
||||
// const CHUNK_RADIUS_UPDATE_PACKET = 0xc9;
|
||||
const REQUEST_CHUNK_RADIUS_PACKET = 0xc8;
|
||||
const CHUNK_RADIUS_UPDATE_PACKET = 0xc9;
|
||||
// const ITEM_FRAME_DROP_ITEM_PACKET = 0xca;
|
||||
// const REPLACE_SELECTED_ITEM_PACKET = 0xcb;
|
||||
}
|
||||
|
39
src/pocketmine/network/protocol/RequestChunkRadiusPacket.php
Normal file
39
src/pocketmine/network/protocol/RequestChunkRadiusPacket.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace pocketmine\network\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
|
||||
class RequestChunkRadiusPacket extends DataPacket{
|
||||
const NETWORK_ID = Info::REQUEST_CHUNK_RADIUS_PACKET;
|
||||
|
||||
public $radius;
|
||||
|
||||
public function decode(){
|
||||
$this->radius = $this->getInt();
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user