mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
Found some things in new packets
This commit is contained in:
parent
91486a23a5
commit
db432bb024
@ -30,12 +30,29 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class LabTablePacket extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::LAB_TABLE_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $uselessByte; //0 for client -> server, 1 for server -> client. Seems useless.
|
||||
|
||||
/** @var int */
|
||||
public $x;
|
||||
/** @var int */
|
||||
public $y;
|
||||
/** @var int */
|
||||
public $z;
|
||||
|
||||
/** @var int */
|
||||
public $reactionType;
|
||||
|
||||
protected function decodePayload(){
|
||||
//TODO
|
||||
$this->uselessByte = $this->getByte();
|
||||
$this->getSignedBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->reactionType = $this->getByte();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
//TODO
|
||||
$this->putByte($this->uselessByte);
|
||||
$this->putSignedBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->putByte($this->reactionType);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -30,12 +30,15 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class RemoveObjectivePacket extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::REMOVE_OBJECTIVE_PACKET;
|
||||
|
||||
/** @var string */
|
||||
public $objectiveName;
|
||||
|
||||
protected function decodePayload(){
|
||||
//TODO
|
||||
$this->objectiveName = $this->getString();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
//TODO
|
||||
$this->putString($this->objectiveName);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -30,12 +30,31 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class SetDisplayObjectivePacket extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::SET_DISPLAY_OBJECTIVE_PACKET;
|
||||
|
||||
/** @var string */
|
||||
public $displaySlot;
|
||||
/** @var string */
|
||||
public $objectiveName;
|
||||
/** @var string */
|
||||
public $displayName;
|
||||
/** @var string */
|
||||
public $criteriaName;
|
||||
/** @var int */
|
||||
public $sortOrder;
|
||||
|
||||
protected function decodePayload(){
|
||||
//TODO
|
||||
$this->displaySlot = $this->getString();
|
||||
$this->objectiveName = $this->getString();
|
||||
$this->displayName = $this->getString();
|
||||
$this->criteriaName = $this->getString();
|
||||
$this->sortOrder = $this->getVarInt();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
//TODO
|
||||
$this->putString($this->displaySlot);
|
||||
$this->putString($this->objectiveName);
|
||||
$this->putString($this->displayName);
|
||||
$this->putString($this->criteriaName);
|
||||
$this->putVarInt($this->sortOrder);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -26,16 +26,37 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
use pocketmine\network\mcpe\protocol\types\ScorePacketEntry;
|
||||
|
||||
class SetScorePacket extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::SET_SCORE_PACKET;
|
||||
|
||||
public const TYPE_MODIFY_SCORE = 0;
|
||||
public const TYPE_RESET_SCORE = 1;
|
||||
|
||||
/** @var int */
|
||||
public $type;
|
||||
/** @var ScorePacketEntry[] */
|
||||
public $entries = [];
|
||||
|
||||
protected function decodePayload(){
|
||||
//TODO
|
||||
$this->type = $this->getByte();
|
||||
for($i = 0, $i2 = $this->getUnsignedVarInt(); $i < $i2; ++$i){
|
||||
$entry = new ScorePacketEntry();
|
||||
$entry->uuid = $this->getUUID();
|
||||
$entry->objectiveName = $this->getString();
|
||||
$entry->score = $this->getLInt();
|
||||
}
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
//TODO
|
||||
$this->putByte($this->type);
|
||||
$this->putUnsignedVarInt(count($this->entries));
|
||||
foreach($this->entries as $entry){
|
||||
$this->putUUID($entry->uuid);
|
||||
$this->putString($entry->objectiveName);
|
||||
$this->putLInt($entry->score);
|
||||
}
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -0,0 +1,35 @@
|
||||
<?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/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\protocol\types;
|
||||
|
||||
use pocketmine\utils\UUID;
|
||||
|
||||
class ScorePacketEntry{
|
||||
/** @var UUID */
|
||||
public $uuid;
|
||||
/** @var string */
|
||||
public $objectiveName;
|
||||
/** @var int */
|
||||
public $score;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user