mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-15 18:29:46 +00:00
Added some fields to new packets
gave up on EventPacket because it's a mess, and StructureBlockUpdate is a job all by itself
This commit is contained in:
parent
4731bf0a16
commit
a5c6c8b973
@ -30,12 +30,15 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class AddBehaviorTreePacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::ADD_BEHAVIOR_TREE_PACKET;
|
||||
|
||||
/** @var string */
|
||||
public $unknownString1;
|
||||
|
||||
public function decodePayload(){
|
||||
//TODO
|
||||
$this->unknownString1 = $this->getString();
|
||||
}
|
||||
|
||||
public function encodePayload(){
|
||||
//TODO
|
||||
$this->putString($this->unknownString1);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -30,12 +30,19 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class CameraPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::CAMERA_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $cameraUniqueId;
|
||||
/** @var int */
|
||||
public $playerUniqueId;
|
||||
|
||||
public function decodePayload(){
|
||||
//TODO
|
||||
$this->cameraUniqueId = $this->getEntityUniqueId();
|
||||
$this->playerUniqueId = $this->getEntityUniqueId();
|
||||
}
|
||||
|
||||
public function encodePayload(){
|
||||
//TODO
|
||||
$this->putEntityUniqueId($this->cameraUniqueId);
|
||||
$this->putEntityUniqueId($this->playerUniqueId);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -30,12 +30,35 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class EventPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::EVENT_PACKET;
|
||||
|
||||
const TYPE_ACHIEVEMENT_AWARDED = 0;
|
||||
const TYPE_ENTITY_INTERACT = 1;
|
||||
const TYPE_PORTAL_BUILT = 2;
|
||||
const TYPE_PORTAL_USED = 3;
|
||||
const TYPE_MOB_KILLED = 4;
|
||||
const TYPE_CAULDRON_USED = 5;
|
||||
const TYPE_PLAYER_DEATH = 6;
|
||||
const TYPE_BOSS_KILLED = 7;
|
||||
const TYPE_AGENT_COMMAND = 8;
|
||||
const TYPE_AGENT_CREATED = 9;
|
||||
|
||||
public $playerRuntimeId;
|
||||
public $eventData;
|
||||
public $type;
|
||||
|
||||
public function decodePayload(){
|
||||
//TODO
|
||||
$this->playerRuntimeId = $this->getEntityRuntimeId();
|
||||
$this->eventData = $this->getVarInt();
|
||||
$this->type = $this->getByte();
|
||||
|
||||
//TODO: nice confusing mess
|
||||
}
|
||||
|
||||
public function encodePayload(){
|
||||
//TODO
|
||||
$this->putEntityRuntimeId($this->playerRuntimeId);
|
||||
$this->putVarInt($this->eventData);
|
||||
$this->putByte($this->type);
|
||||
|
||||
//TODO: also nice confusing mess
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -30,12 +30,21 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class PurchaseReceiptPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::PURCHASE_RECEIPT_PACKET;
|
||||
|
||||
/** @var string[] */
|
||||
public $entries = [];
|
||||
|
||||
public function decodePayload(){
|
||||
//TODO
|
||||
$count = $this->getUnsignedVarInt();
|
||||
for($i = 0; $i < $count; ++$i){
|
||||
$this->entries[] = $this->getString();
|
||||
}
|
||||
}
|
||||
|
||||
public function encodePayload(){
|
||||
//TODO
|
||||
$this->putUnsignedVarInt(count($this->entries));
|
||||
foreach($this->entries as $entry){
|
||||
$this->putString($entry);
|
||||
}
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -30,12 +30,14 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class ShowStoreOfferPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::SHOW_STORE_OFFER_PACKET;
|
||||
|
||||
public $offerId;
|
||||
|
||||
public function decodePayload(){
|
||||
//TODO
|
||||
$this->offerId = $this->getString();
|
||||
}
|
||||
|
||||
public function encodePayload(){
|
||||
//TODO
|
||||
$this->putString($this->offerId);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -30,12 +30,14 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class SimpleEventPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::SIMPLE_EVENT_PACKET;
|
||||
|
||||
public $unknownShort1;
|
||||
|
||||
public function decodePayload(){
|
||||
//TODO
|
||||
$this->unknownShort1 = $this->getLShort();
|
||||
}
|
||||
|
||||
public function encodePayload(){
|
||||
//TODO
|
||||
$this->putLShort($this->unknownShort1);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -30,12 +30,26 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class UpdateEquipPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::UPDATE_EQUIP_PACKET;
|
||||
|
||||
public $windowId;
|
||||
public $windowType;
|
||||
public $unknownVarint; //TODO: find out what this is (vanilla always sends 0)
|
||||
public $entityUniqueId;
|
||||
public $namedtag;
|
||||
|
||||
public function decodePayload(){
|
||||
//TODO
|
||||
$this->windowId = $this->getByte();
|
||||
$this->windowType = $this->getByte();
|
||||
$this->unknownVarint = $this->getVarInt();
|
||||
$this->entityUniqueId = $this->getEntityUniqueId();
|
||||
$this->namedtag = $this->get(true);
|
||||
}
|
||||
|
||||
public function encodePayload(){
|
||||
//TODO
|
||||
$this->putByte($this->windowId);
|
||||
$this->putByte($this->windowType);
|
||||
$this->putVarInt($this->unknownVarint);
|
||||
$this->putEntityUniqueId($this->entityUniqueId);
|
||||
$this->put($this->namedtag);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
Loading…
x
Reference in New Issue
Block a user