mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-11 05:55:33 +00:00
Added PhpDoc for packet field types and changed float x,y,z to Vector3
This commit is contained in:
parent
6480f7a989
commit
9be1b929a5
@ -920,9 +920,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
|
||||
protected function sendRespawnPacket(Vector3 $pos){
|
||||
$pk = new RespawnPacket();
|
||||
$pk->x = $pos->x;
|
||||
$pk->y = $pos->y + $this->baseOffset;
|
||||
$pk->z = $pos->z;
|
||||
$pk->position = $pos->add(0, $this->baseOffset, 0);
|
||||
|
||||
$this->dataPacket($pk);
|
||||
}
|
||||
|
||||
@ -1581,7 +1580,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
if($to->distanceSquared($ev->getTo()) > 0.01){ //If plugins modify the destination
|
||||
$this->teleport($ev->getTo());
|
||||
}else{
|
||||
$this->level->addEntityMovement($this->x >> 4, $this->z >> 4, $this->getId(), $this->x, $this->y + $this->baseOffset, $this->z, $this->yaw, $this->pitch, $this->yaw);
|
||||
$this->broadcastMovement();
|
||||
|
||||
$distance = $from->distance($to);
|
||||
//TODO: check swimming (adds 0.015 exhaustion in MCPE)
|
||||
@ -1621,7 +1620,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
public function setMotion(Vector3 $mot){
|
||||
if(parent::setMotion($mot)){
|
||||
if($this->chunk !== null){
|
||||
$this->level->addEntityMotion($this->chunk->getX(), $this->chunk->getZ(), $this->getId(), $this->motionX, $this->motionY, $this->motionZ);
|
||||
$this->broadcastMotion();
|
||||
}
|
||||
|
||||
if($this->motionY > 0){
|
||||
@ -1865,9 +1864,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
$pk->entityUniqueId = $this->id;
|
||||
$pk->entityRuntimeId = $this->id;
|
||||
$pk->playerGamemode = Player::getClientFriendlyGamemode($this->gamemode);
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y + $this->baseOffset;
|
||||
$pk->z = $this->z;
|
||||
|
||||
$pk->playerPosition = $this->getOffsetPosition();
|
||||
|
||||
$pk->pitch = $this->pitch;
|
||||
$pk->yaw = $this->yaw;
|
||||
$pk->seed = -1;
|
||||
@ -2086,7 +2085,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}
|
||||
|
||||
public function handleMovePlayer(MovePlayerPacket $packet) : bool{
|
||||
$newPos = new Vector3($packet->x, $packet->y - $this->baseOffset, $packet->z);
|
||||
$newPos = $packet->position->subtract(0, $this->baseOffset, 0);
|
||||
|
||||
if($this->isTeleporting and $newPos->distanceSquared($this) > 1){ //Tolerate up to 1 block to avoid problems with client-sided physics when spawning in blocks
|
||||
$this->server->getLogger()->debug("Ignoring outdated pre-teleport movement from " . $this->getName() . ", received " . $newPos . ", expected " . $this->asVector3());
|
||||
@ -3746,9 +3745,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
|
||||
$pk = new MovePlayerPacket();
|
||||
$pk->entityRuntimeId = $this->getId();
|
||||
$pk->x = $pos->x;
|
||||
$pk->y = $pos->y + ($baseOffsetOverride ?? $this->baseOffset);
|
||||
$pk->z = $pos->z;
|
||||
$pk->position = $this->getOffsetPosition();
|
||||
$pk->bodyYaw = $yaw;
|
||||
$pk->pitch = $pitch;
|
||||
$pk->yaw = $yaw;
|
||||
|
@ -89,12 +89,9 @@ class Arrow extends Projectile{
|
||||
$pk = new AddEntityPacket();
|
||||
$pk->type = Arrow::NETWORK_ID;
|
||||
$pk->entityRuntimeId = $this->getId();
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->speedX = $this->motionX;
|
||||
$pk->speedY = $this->motionY;
|
||||
$pk->speedZ = $this->motionZ;
|
||||
$pk->position = $this->asVector3();
|
||||
$pk->motion = $this->getMotion();
|
||||
|
||||
$pk->yaw = $this->yaw;
|
||||
$pk->pitch = $this->pitch;
|
||||
$pk->metadata = $this->dataProperties;
|
||||
|
@ -54,8 +54,10 @@ use pocketmine\nbt\tag\FloatTag;
|
||||
use pocketmine\nbt\tag\ListTag;
|
||||
use pocketmine\nbt\tag\ShortTag;
|
||||
use pocketmine\nbt\tag\StringTag;
|
||||
use pocketmine\network\mcpe\protocol\MoveEntityPacket;
|
||||
use pocketmine\network\mcpe\protocol\RemoveEntityPacket;
|
||||
use pocketmine\network\mcpe\protocol\SetEntityDataPacket;
|
||||
use pocketmine\network\mcpe\protocol\SetEntityMotionPacket;
|
||||
use pocketmine\Player;
|
||||
use pocketmine\plugin\Plugin;
|
||||
use pocketmine\Server;
|
||||
@ -1146,7 +1148,7 @@ abstract class Entity extends Location implements Metadatable{
|
||||
$this->lastYaw = $this->yaw;
|
||||
$this->lastPitch = $this->pitch;
|
||||
|
||||
$this->level->addEntityMovement($this->chunk->getX(), $this->chunk->getZ(), $this->id, $this->x, $this->y + $this->baseOffset, $this->z, $this->yaw, $this->pitch, $this->yaw);
|
||||
$this->broadcastMovement();
|
||||
}
|
||||
|
||||
if($diffMotion > 0.0025 or ($diffMotion > 0.0001 and $this->getMotion()->lengthSquared() <= 0.0001)){ //0.05 ** 2
|
||||
@ -1154,10 +1156,33 @@ abstract class Entity extends Location implements Metadatable{
|
||||
$this->lastMotionY = $this->motionY;
|
||||
$this->lastMotionZ = $this->motionZ;
|
||||
|
||||
$this->level->addEntityMotion($this->chunk->getX(), $this->chunk->getZ(), $this->id, $this->motionX, $this->motionY, $this->motionZ);
|
||||
$this->broadcastMotion();
|
||||
}
|
||||
}
|
||||
|
||||
public function getOffsetPosition() : Vector3{
|
||||
return new Vector3($this->x, $this->y + $this->baseOffset, $this->z);
|
||||
}
|
||||
|
||||
protected function broadcastMovement(){
|
||||
$pk = new MoveEntityPacket();
|
||||
$pk->entityRuntimeId = $this->id;
|
||||
$pk->position = $this->getOffsetPosition();
|
||||
$pk->yaw = $this->yaw;
|
||||
$pk->pitch = $this->pitch;
|
||||
$pk->headYaw = $this->yaw; //TODO
|
||||
|
||||
$this->level->addChunkPacket($this->chunk->getX(), $this->chunk->getZ(), $pk);
|
||||
}
|
||||
|
||||
protected function broadcastMotion(){
|
||||
$pk = new SetEntityMotionPacket();
|
||||
$pk->entityRuntimeId = $this->id;
|
||||
$pk->motion = $this->getMotion();
|
||||
|
||||
$this->level->addChunkPacket($this->chunk->getX(), $this->chunk->getZ(), $pk);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Vector3
|
||||
*/
|
||||
|
@ -148,12 +148,8 @@ class FallingSand extends Entity{
|
||||
$pk = new AddEntityPacket();
|
||||
$pk->type = FallingSand::NETWORK_ID;
|
||||
$pk->entityRuntimeId = $this->getId();
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->speedX = $this->motionX;
|
||||
$pk->speedY = $this->motionY;
|
||||
$pk->speedZ = $this->motionZ;
|
||||
$pk->position = $this->asVector3();
|
||||
$pk->motion = $this->getMotion();
|
||||
$pk->yaw = $this->yaw;
|
||||
$pk->pitch = $this->pitch;
|
||||
$pk->metadata = $this->dataProperties;
|
||||
|
@ -515,12 +515,8 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
$pk->uuid = $this->getUniqueId();
|
||||
$pk->username = $this->getName();
|
||||
$pk->entityRuntimeId = $this->getId();
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->speedX = $this->motionX;
|
||||
$pk->speedY = $this->motionY;
|
||||
$pk->speedZ = $this->motionZ;
|
||||
$pk->position = $this->asVector3();
|
||||
$pk->motion = $this->getMotion();
|
||||
$pk->yaw = $this->yaw;
|
||||
$pk->pitch = $this->pitch;
|
||||
$pk->item = $this->getInventory()->getItemInHand();
|
||||
|
@ -234,12 +234,8 @@ class Item extends Entity{
|
||||
public function spawnTo(Player $player){
|
||||
$pk = new AddItemEntityPacket();
|
||||
$pk->entityRuntimeId = $this->getId();
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->speedX = $this->motionX;
|
||||
$pk->speedY = $this->motionY;
|
||||
$pk->speedZ = $this->motionZ;
|
||||
$pk->position = $this->asVector3();
|
||||
$pk->motion = $this->getMotion();
|
||||
$pk->item = $this->getItem();
|
||||
$pk->metadata = $this->dataProperties;
|
||||
$player->dataPacket($pk);
|
||||
|
@ -149,12 +149,8 @@ class PrimedTNT extends Entity implements Explosive{
|
||||
$pk = new AddEntityPacket();
|
||||
$pk->type = PrimedTNT::NETWORK_ID;
|
||||
$pk->entityRuntimeId = $this->getId();
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->speedX = $this->motionX;
|
||||
$pk->speedY = $this->motionY;
|
||||
$pk->speedZ = $this->motionZ;
|
||||
$pk->position = $this->asVector3();
|
||||
$pk->motion = $this->getMotion();
|
||||
$pk->metadata = $this->dataProperties;
|
||||
$player->dataPacket($pk);
|
||||
|
||||
|
@ -65,12 +65,8 @@ class Snowball extends Projectile{
|
||||
$pk = new AddEntityPacket();
|
||||
$pk->type = Snowball::NETWORK_ID;
|
||||
$pk->entityRuntimeId = $this->getId();
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->speedX = $this->motionX;
|
||||
$pk->speedY = $this->motionY;
|
||||
$pk->speedZ = $this->motionZ;
|
||||
$pk->position = $this->asVector3();
|
||||
$pk->motion = $this->getMotion();
|
||||
$pk->metadata = $this->dataProperties;
|
||||
$player->dataPacket($pk);
|
||||
|
||||
|
@ -150,12 +150,8 @@ class Squid extends WaterAnimal{
|
||||
$pk = new AddEntityPacket();
|
||||
$pk->entityRuntimeId = $this->getId();
|
||||
$pk->type = Squid::NETWORK_ID;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->speedX = $this->motionX;
|
||||
$pk->speedY = $this->motionY;
|
||||
$pk->speedZ = $this->motionZ;
|
||||
$pk->position = $this->asVector3();
|
||||
$pk->motion = $this->getMotion();
|
||||
$pk->yaw = $this->yaw;
|
||||
$pk->pitch = $this->pitch;
|
||||
$pk->metadata = $this->dataProperties;
|
||||
|
@ -56,12 +56,8 @@ class Villager extends Creature implements NPC, Ageable{
|
||||
$pk = new AddEntityPacket();
|
||||
$pk->entityRuntimeId = $this->getId();
|
||||
$pk->type = Villager::NETWORK_ID;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->speedX = $this->motionX;
|
||||
$pk->speedY = $this->motionY;
|
||||
$pk->speedZ = $this->motionZ;
|
||||
$pk->position = $this->asVector3();
|
||||
$pk->motion = $this->getMotion();
|
||||
$pk->yaw = $this->yaw;
|
||||
$pk->pitch = $this->pitch;
|
||||
$pk->metadata = $this->dataProperties;
|
||||
|
@ -43,12 +43,8 @@ class Zombie extends Monster{
|
||||
$pk = new AddEntityPacket();
|
||||
$pk->entityRuntimeId = $this->getId();
|
||||
$pk->type = Zombie::NETWORK_ID;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->speedX = $this->motionX;
|
||||
$pk->speedY = $this->motionY;
|
||||
$pk->speedZ = $this->motionZ;
|
||||
$pk->position = $this->asVector3();
|
||||
$pk->motion = $this->getMotion();
|
||||
$pk->yaw = $this->yaw;
|
||||
$pk->pitch = $this->pitch;
|
||||
$pk->metadata = $this->dataProperties;
|
||||
|
@ -195,9 +195,7 @@ class Explosion{
|
||||
}
|
||||
|
||||
$pk = new ExplodePacket();
|
||||
$pk->x = $this->source->x;
|
||||
$pk->y = $this->source->y;
|
||||
$pk->z = $this->source->z;
|
||||
$pk->position = $this->source->asVector3();
|
||||
$pk->radius = $this->size;
|
||||
$pk->records = $send;
|
||||
$this->level->addChunkPacket($source->x >> 4, $source->z >> 4, $pk);
|
||||
|
@ -97,8 +97,6 @@ use pocketmine\network\mcpe\protocol\BatchPacket;
|
||||
use pocketmine\network\mcpe\protocol\DataPacket;
|
||||
use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\MoveEntityPacket;
|
||||
use pocketmine\network\mcpe\protocol\SetEntityMotionPacket;
|
||||
use pocketmine\network\mcpe\protocol\SetTimePacket;
|
||||
use pocketmine\network\mcpe\protocol\UpdateBlockPacket;
|
||||
use pocketmine\Player;
|
||||
@ -518,7 +516,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
$pk->extraData = $extraData;
|
||||
$pk->unknownBool = $unknown;
|
||||
$pk->disableRelativeVolume = $disableRelativeVolume;
|
||||
list($pk->x, $pk->y, $pk->z) = [$pos->x, $pos->y, $pos->z];
|
||||
$pk->position = $pos->asVector3();
|
||||
$this->addChunkPacket($pos->x >> 4, $pos->z >> 4, $pk);
|
||||
}
|
||||
|
||||
@ -2922,25 +2920,4 @@ class Level implements ChunkManager, Metadatable{
|
||||
public function removeMetadata($metadataKey, Plugin $plugin){
|
||||
$this->server->getLevelMetadata()->removeMetadata($this, $metadataKey, $plugin);
|
||||
}
|
||||
|
||||
public function addEntityMotion(int $chunkX, int $chunkZ, int $entityId, float $x, float $y, float $z){
|
||||
$pk = new SetEntityMotionPacket();
|
||||
$pk->entityRuntimeId = $entityId;
|
||||
$pk->motionX = $x;
|
||||
$pk->motionY = $y;
|
||||
$pk->motionZ = $z;
|
||||
$this->addChunkPacket($chunkX, $chunkZ, $pk);
|
||||
}
|
||||
|
||||
public function addEntityMovement(int $chunkX, int $chunkZ, int $entityId, float $x, float $y, float $z, float $yaw, float $pitch, $headYaw = null){
|
||||
$pk = new MoveEntityPacket();
|
||||
$pk->entityRuntimeId = $entityId;
|
||||
$pk->x = $x;
|
||||
$pk->y = $y;
|
||||
$pk->z = $z;
|
||||
$pk->yaw = $yaw;
|
||||
$pk->pitch = $pitch;
|
||||
$pk->headYaw = $headYaw ?? $yaw;
|
||||
$this->addChunkPacket($chunkX, $chunkZ, $pk);
|
||||
}
|
||||
}
|
||||
|
@ -39,9 +39,7 @@ class DestroyBlockParticle extends Particle{
|
||||
public function encode(){
|
||||
$pk = new LevelEventPacket;
|
||||
$pk->evid = LevelEventPacket::EVENT_PARTICLE_DESTROY;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->position = $this->asVector3();
|
||||
$pk->data = $this->data;
|
||||
|
||||
return $pk;
|
||||
|
@ -81,12 +81,7 @@ class FloatingTextParticle extends Particle{
|
||||
$pk = new AddEntityPacket();
|
||||
$pk->entityRuntimeId = $this->entityId;
|
||||
$pk->type = ItemEntity::NETWORK_ID;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y - 0.75;
|
||||
$pk->z = $this->z;
|
||||
$pk->speedX = 0;
|
||||
$pk->speedY = 0;
|
||||
$pk->speedZ = 0;
|
||||
$pk->position = $this->asVector3()->subtract(0, 0.75, 0);
|
||||
$pk->yaw = 0;
|
||||
$pk->pitch = 0;
|
||||
$flags = (
|
||||
|
@ -40,9 +40,7 @@ class GenericParticle extends Particle{
|
||||
public function encode(){
|
||||
$pk = new LevelEventPacket;
|
||||
$pk->evid = LevelEventPacket::EVENT_ADD_PARTICLE_MASK | $this->id;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->position = $this->asVector3();
|
||||
$pk->data = $this->data;
|
||||
|
||||
return $pk;
|
||||
|
@ -40,9 +40,7 @@ class MobSpawnParticle extends Particle{
|
||||
public function encode(){
|
||||
$pk = new LevelEventPacket;
|
||||
$pk->evid = LevelEventPacket::EVENT_PARTICLE_SPAWN;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->position = $this->asVector3();
|
||||
$pk->data = ($this->width & 0xff) + (($this->height & 0xff) << 8);
|
||||
|
||||
return $pk;
|
||||
|
@ -49,9 +49,7 @@ class GenericSound extends Sound{
|
||||
public function encode(){
|
||||
$pk = new LevelEventPacket;
|
||||
$pk->evid = $this->id;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->position = $this->asVector3();
|
||||
$pk->data = (int) $this->pitch;
|
||||
|
||||
return $pk;
|
||||
|
@ -26,6 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\entity\Attribute;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
|
||||
class AddEntityPacket extends DataPacket{
|
||||
@ -35,26 +36,30 @@ class AddEntityPacket extends DataPacket{
|
||||
public $entityUniqueId = null; //TODO
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
/** @var int */
|
||||
public $type;
|
||||
public $x;
|
||||
public $y;
|
||||
public $z;
|
||||
public $speedX = 0.0;
|
||||
public $speedY = 0.0;
|
||||
public $speedZ = 0.0;
|
||||
/** @var Vector3 */
|
||||
public $position;
|
||||
/** @var Vector3|null */
|
||||
public $motion;
|
||||
/** @var float */
|
||||
public $yaw = 0.0;
|
||||
/** @var float */
|
||||
public $pitch = 0.0;
|
||||
|
||||
/** @var Attribute[] */
|
||||
public $attributes = [];
|
||||
/** @var array */
|
||||
public $metadata = [];
|
||||
/** @var array */
|
||||
public $links = [];
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->entityUniqueId = $this->getEntityUniqueId();
|
||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||
$this->type = $this->getUnsignedVarInt();
|
||||
$this->getVector3f($this->x, $this->y, $this->z);
|
||||
$this->getVector3f($this->speedX, $this->speedY, $this->speedZ);
|
||||
$this->position = $this->getVector3Obj();
|
||||
$this->motion = $this->getVector3Obj();
|
||||
$this->pitch = $this->getLFloat();
|
||||
$this->yaw = $this->getLFloat();
|
||||
|
||||
@ -87,8 +92,8 @@ class AddEntityPacket extends DataPacket{
|
||||
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$this->putUnsignedVarInt($this->type);
|
||||
$this->putVector3f($this->x, $this->y, $this->z);
|
||||
$this->putVector3f($this->speedX, $this->speedY, $this->speedZ);
|
||||
$this->putVector3Obj($this->position);
|
||||
$this->putVector3ObjNullable($this->motion);
|
||||
$this->putLFloat($this->pitch);
|
||||
$this->putLFloat($this->yaw);
|
||||
|
||||
|
@ -30,11 +30,17 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class AddHangingEntityPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::ADD_HANGING_ENTITY_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $entityUniqueId;
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
/** @var int */
|
||||
public $x;
|
||||
/** @var int */
|
||||
public $y;
|
||||
/** @var int */
|
||||
public $z;
|
||||
/** @var int */
|
||||
public $unknown; //TODO (rotation?)
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -25,7 +25,8 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
|
||||
class AddItemEntityPacket extends DataPacket{
|
||||
@ -35,21 +36,21 @@ class AddItemEntityPacket extends DataPacket{
|
||||
public $entityUniqueId = null; //TODO
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
/** @var Item */
|
||||
public $item;
|
||||
public $x;
|
||||
public $y;
|
||||
public $z;
|
||||
public $speedX = 0.0;
|
||||
public $speedY = 0.0;
|
||||
public $speedZ = 0.0;
|
||||
/** @var Vector3 */
|
||||
public $position;
|
||||
/** @var Vector3|null */
|
||||
public $motion;
|
||||
/** @var array */
|
||||
public $metadata = [];
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->entityUniqueId = $this->getEntityUniqueId();
|
||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||
$this->item = $this->getSlot();
|
||||
$this->getVector3f($this->x, $this->y, $this->z);
|
||||
$this->getVector3f($this->speedX, $this->speedY, $this->speedZ);
|
||||
$this->position = $this->getVector3Obj();
|
||||
$this->motion = $this->getVector3Obj();
|
||||
$this->metadata = $this->getEntityMetadata();
|
||||
}
|
||||
|
||||
@ -57,8 +58,8 @@ class AddItemEntityPacket extends DataPacket{
|
||||
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$this->putSlot($this->item);
|
||||
$this->putVector3f($this->x, $this->y, $this->z);
|
||||
$this->putVector3f($this->speedX, $this->speedY, $this->speedZ);
|
||||
$this->putVector3Obj($this->position);
|
||||
$this->putVector3ObjNullable($this->motion);
|
||||
$this->putEntityMetadata($this->metadata);
|
||||
}
|
||||
|
||||
|
@ -35,10 +35,15 @@ class AddPaintingPacket extends DataPacket{
|
||||
public $entityUniqueId = null; //TODO
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
/** @var int */
|
||||
public $x;
|
||||
/** @var int */
|
||||
public $y;
|
||||
/** @var int */
|
||||
public $z;
|
||||
/** @var int */
|
||||
public $direction;
|
||||
/** @var string */
|
||||
public $title;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -26,6 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
use pocketmine\utils\UUID;
|
||||
|
||||
@ -40,17 +41,19 @@ class AddPlayerPacket extends DataPacket{
|
||||
public $entityUniqueId = null; //TODO
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
public $x;
|
||||
public $y;
|
||||
public $z;
|
||||
public $speedX = 0.0;
|
||||
public $speedY = 0.0;
|
||||
public $speedZ = 0.0;
|
||||
/** @var Vector3 */
|
||||
public $position;
|
||||
/** @var Vector3|null */
|
||||
public $motion;
|
||||
/** @var float */
|
||||
public $pitch = 0.0;
|
||||
/** @var float|null */
|
||||
public $headYaw = null; //TODO
|
||||
/** @var float */
|
||||
public $yaw = 0.0;
|
||||
/** @var Item */
|
||||
public $item;
|
||||
/** @var array */
|
||||
public $metadata = [];
|
||||
|
||||
//TODO: adventure settings stuff
|
||||
@ -68,8 +71,8 @@ class AddPlayerPacket extends DataPacket{
|
||||
$this->username = $this->getString();
|
||||
$this->entityUniqueId = $this->getEntityUniqueId();
|
||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||
$this->getVector3f($this->x, $this->y, $this->z);
|
||||
$this->getVector3f($this->speedX, $this->speedY, $this->speedZ);
|
||||
$this->position = $this->getVector3Obj();
|
||||
$this->motion = $this->getVector3Obj();
|
||||
$this->pitch = $this->getLFloat();
|
||||
$this->headYaw = $this->getLFloat();
|
||||
$this->yaw = $this->getLFloat();
|
||||
@ -94,8 +97,8 @@ class AddPlayerPacket extends DataPacket{
|
||||
$this->putString($this->username);
|
||||
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$this->putVector3f($this->x, $this->y, $this->z);
|
||||
$this->putVector3f($this->speedX, $this->speedY, $this->speedZ);
|
||||
$this->putVector3Obj($this->position);
|
||||
$this->putVector3ObjNullable($this->motion);
|
||||
$this->putLFloat($this->pitch);
|
||||
$this->putLFloat($this->headYaw ?? $this->yaw);
|
||||
$this->putLFloat($this->yaw);
|
||||
|
@ -65,10 +65,15 @@ class AdventureSettingsPacket extends DataPacket{
|
||||
const OPERATOR = 0x20 | self::BITFLAG_SECOND_SET;
|
||||
const TELEPORT = 0x80 | self::BITFLAG_SECOND_SET;
|
||||
|
||||
/** @var int */
|
||||
public $flags = 0;
|
||||
/** @var int */
|
||||
public $commandPermission = self::PERMISSION_NORMAL;
|
||||
/** @var int */
|
||||
public $flags2 = -1;
|
||||
/** @var int */
|
||||
public $playerPermission = PlayerPermissions::MEMBER;
|
||||
/** @var int */
|
||||
public $entityUniqueId; //This is a little-endian long, NOT a var-long. (WTF Mojang)
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -36,8 +36,11 @@ class AnimatePacket extends DataPacket{
|
||||
const ACTION_STOP_SLEEP = 3;
|
||||
const ACTION_CRITICAL_HIT = 4;
|
||||
|
||||
/** @var int */
|
||||
public $action;
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
/** @var float */
|
||||
public $float = 0.0; //TODO (Boat rowing time?)
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -31,9 +31,13 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class BlockEntityDataPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::BLOCK_ENTITY_DATA_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $x;
|
||||
/** @var int */
|
||||
public $y;
|
||||
/** @var int */
|
||||
public $z;
|
||||
/** @var string */
|
||||
public $namedtag;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -31,10 +31,15 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class BlockEventPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::BLOCK_EVENT_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $x;
|
||||
/** @var int */
|
||||
public $y;
|
||||
/** @var int */
|
||||
public $z;
|
||||
/** @var int */
|
||||
public $case1;
|
||||
/** @var int */
|
||||
public $case2;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -32,10 +32,15 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class BlockPickRequestPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::BLOCK_PICK_REQUEST_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $tileX;
|
||||
/** @var int */
|
||||
public $tileY;
|
||||
/** @var int */
|
||||
public $tileZ;
|
||||
/** @var bool */
|
||||
public $addUserData = false;
|
||||
/** @var int */
|
||||
public $hotbarSlot;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -48,7 +48,9 @@ class BossEventPacket extends DataPacket{
|
||||
/* S2C: Not implemented :( Intended to alter bar appearance, but these currently produce no effect on client-side whatsoever. */
|
||||
const TYPE_TEXTURE = 7;
|
||||
|
||||
/** @var int */
|
||||
public $bossEid;
|
||||
/** @var int */
|
||||
public $eventType;
|
||||
|
||||
/** @var int (long) */
|
||||
|
@ -26,6 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
|
||||
class ChangeDimensionPacket extends DataPacket{
|
||||
@ -33,24 +34,20 @@ class ChangeDimensionPacket extends DataPacket{
|
||||
|
||||
/** @var int */
|
||||
public $dimension;
|
||||
/** @var float */
|
||||
public $x;
|
||||
/** @var float */
|
||||
public $y;
|
||||
/** @var float */
|
||||
public $z;
|
||||
/** @var Vector3 */
|
||||
public $position;
|
||||
/** @var bool */
|
||||
public $respawn = false;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->dimension = $this->getVarInt();
|
||||
$this->getVector3f($this->x, $this->y, $this->z);
|
||||
$this->position = $this->getVector3Obj();
|
||||
$this->respawn = $this->getBool();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putVarInt($this->dimension);
|
||||
$this->putVector3f($this->x, $this->y, $this->z);
|
||||
$this->putVector3Obj($this->position);
|
||||
$this->putBool($this->respawn);
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,7 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class ChunkRadiusUpdatedPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::CHUNK_RADIUS_UPDATED_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $radius;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -36,16 +36,25 @@ class ClientboundMapItemDataPacket extends DataPacket{
|
||||
const BITFLAG_TEXTURE_UPDATE = 0x02;
|
||||
const BITFLAG_DECORATION_UPDATE = 0x04;
|
||||
|
||||
/** @var int */
|
||||
public $mapId;
|
||||
/** @var int */
|
||||
public $type;
|
||||
|
||||
/** @var int[] */
|
||||
public $eids = [];
|
||||
/** @var int */
|
||||
public $scale;
|
||||
/** @var array */
|
||||
public $decorations = [];
|
||||
|
||||
/** @var int */
|
||||
public $width;
|
||||
/** @var int */
|
||||
public $height;
|
||||
/** @var int */
|
||||
public $xOffset = 0;
|
||||
/** @var int */
|
||||
public $yOffset = 0;
|
||||
/** @var Color[][] */
|
||||
public $colors = [];
|
||||
|
@ -32,21 +32,32 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class CommandBlockUpdatePacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::COMMAND_BLOCK_UPDATE_PACKET;
|
||||
|
||||
/** @var bool */
|
||||
public $isBlock;
|
||||
|
||||
/** @var int */
|
||||
public $x;
|
||||
/** @var int */
|
||||
public $y;
|
||||
/** @var int */
|
||||
public $z;
|
||||
/** @var int */
|
||||
public $commandBlockMode;
|
||||
/** @var bool */
|
||||
public $isRedstoneMode;
|
||||
/** @var bool */
|
||||
public $isConditional;
|
||||
|
||||
/** @var int */
|
||||
public $minecartEid;
|
||||
|
||||
/** @var string */
|
||||
public $command;
|
||||
/** @var string */
|
||||
public $lastOutput;
|
||||
/** @var string */
|
||||
public $name;
|
||||
|
||||
/** @var bool */
|
||||
public $shouldTrackOutput;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -30,6 +30,7 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class CommandRequestPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::COMMAND_REQUEST_PACKET;
|
||||
|
||||
/** @var string */
|
||||
public $command;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -31,6 +31,7 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class ContainerClosePacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::CONTAINER_CLOSE_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $windowId;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -31,11 +31,17 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class ContainerOpenPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::CONTAINER_OPEN_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $windowId;
|
||||
/** @var int */
|
||||
public $type;
|
||||
/** @var int */
|
||||
public $x;
|
||||
/** @var int */
|
||||
public $y;
|
||||
/** @var int */
|
||||
public $z;
|
||||
/** @var int */
|
||||
public $entityUniqueId = -1;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -41,8 +41,11 @@ class ContainerSetDataPacket extends DataPacket{
|
||||
const PROPERTY_BREWING_STAND_FUEL_AMOUNT = 1;
|
||||
const PROPERTY_BREWING_STAND_FUEL_TOTAL = 2;
|
||||
|
||||
/** @var int */
|
||||
public $windowId;
|
||||
/** @var int */
|
||||
public $property;
|
||||
/** @var int */
|
||||
public $value;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -45,6 +45,7 @@ class CraftingDataPacket extends DataPacket{
|
||||
|
||||
/** @var object[] */
|
||||
public $entries = [];
|
||||
/** @var bool */
|
||||
public $cleanRecipes = false;
|
||||
|
||||
public function clean(){
|
||||
|
@ -32,7 +32,9 @@ use pocketmine\utils\UUID;
|
||||
class CraftingEventPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::CRAFTING_EVENT_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $windowId;
|
||||
/** @var int */
|
||||
public $type;
|
||||
/** @var UUID */
|
||||
public $id;
|
||||
|
@ -38,9 +38,12 @@ abstract class DataPacket extends BinaryStream{
|
||||
|
||||
const NETWORK_ID = 0;
|
||||
|
||||
/** @var bool */
|
||||
public $isEncoded = false;
|
||||
|
||||
/** @var int */
|
||||
public $extraByte1 = 0;
|
||||
/** @var int */
|
||||
public $extraByte2 = 0;
|
||||
|
||||
public function pid(){
|
||||
|
@ -31,7 +31,9 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class DisconnectPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::DISCONNECT_PACKET;
|
||||
|
||||
/** @var bool */
|
||||
public $hideDisconnectionScreen = false;
|
||||
/** @var string */
|
||||
public $message;
|
||||
|
||||
public function canBeSentBeforeLogin() : bool{
|
||||
|
@ -50,8 +50,11 @@ class EntityEventPacket extends DataPacket{
|
||||
|
||||
//TODO: add more events
|
||||
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
/** @var int */
|
||||
public $event;
|
||||
/** @var int */
|
||||
public $data = 0;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -31,8 +31,11 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class EntityFallPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::ENTITY_FALL_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
/** @var float */
|
||||
public $fallDistance;
|
||||
/** @var bool */
|
||||
public $bool1;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -30,7 +30,9 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class EntityPickRequestPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::ENTITY_PICK_REQUEST_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $entityTypeId;
|
||||
/** @var int */
|
||||
public $hotbarSlot;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -41,8 +41,11 @@ class EventPacket extends DataPacket{
|
||||
const TYPE_AGENT_COMMAND = 8;
|
||||
const TYPE_AGENT_CREATED = 9;
|
||||
|
||||
/** @var int */
|
||||
public $playerRuntimeId;
|
||||
/** @var int */
|
||||
public $eventData;
|
||||
/** @var int */
|
||||
public $type;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -32,9 +32,8 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class ExplodePacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::EXPLODE_PACKET;
|
||||
|
||||
public $x;
|
||||
public $y;
|
||||
public $z;
|
||||
/** @var Vector3 */
|
||||
public $position;
|
||||
/** @var float */
|
||||
public $radius;
|
||||
/** @var Vector3[] */
|
||||
@ -46,7 +45,7 @@ class ExplodePacket extends DataPacket{
|
||||
}
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->getVector3f($this->x, $this->y, $this->z);
|
||||
$this->position = $this->getVector3Obj();
|
||||
$this->radius = (float) ($this->getVarInt() / 32);
|
||||
$count = $this->getUnsignedVarInt();
|
||||
for($i = 0; $i < $count; ++$i){
|
||||
@ -57,7 +56,7 @@ class ExplodePacket extends DataPacket{
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putVector3f($this->x, $this->y, $this->z);
|
||||
$this->putVector3Obj($this->position);
|
||||
$this->putVarInt((int) ($this->radius * 32));
|
||||
$this->putUnsignedVarInt(count($this->records));
|
||||
if(count($this->records) > 0){
|
||||
|
@ -31,8 +31,11 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class FullChunkDataPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::FULL_CHUNK_DATA_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $chunkX;
|
||||
/** @var int */
|
||||
public $chunkZ;
|
||||
/** @var string */
|
||||
public $data;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -30,6 +30,7 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class GameRulesChangedPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::GAME_RULES_CHANGED_PACKET;
|
||||
|
||||
/** @var array */
|
||||
public $gameRules = [];
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -31,6 +31,7 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class HurtArmorPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::HURT_ARMOR_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $health;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -53,6 +53,7 @@ class InteractPacket extends DataPacket{
|
||||
$this->target = $this->getEntityRuntimeId();
|
||||
|
||||
if($this->action === self::ACTION_MOUSEOVER){
|
||||
//TODO: should this be a vector3?
|
||||
$this->x = $this->getLFloat();
|
||||
$this->y = $this->getLFloat();
|
||||
$this->z = $this->getLFloat();
|
||||
|
@ -95,6 +95,7 @@ class InventoryTransactionPacket extends DataPacket{
|
||||
/** @var InventoryAction[] */
|
||||
public $actions = [];
|
||||
|
||||
/** @var \stdClass */
|
||||
public $transactionData;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -31,8 +31,11 @@ class ItemFrameDropItemPacket extends DataPacket{
|
||||
|
||||
const NETWORK_ID = ProtocolInfo::ITEM_FRAME_DROP_ITEM_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $x;
|
||||
/** @var int */
|
||||
public $y;
|
||||
/** @var int */
|
||||
public $z;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -25,6 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
|
||||
class LevelEventPacket extends DataPacket{
|
||||
@ -100,21 +101,22 @@ class LevelEventPacket extends DataPacket{
|
||||
|
||||
const EVENT_ADD_PARTICLE_MASK = 0x4000;
|
||||
|
||||
/** @var int */
|
||||
public $evid;
|
||||
public $x = 0; //Weather effects don't have coordinates
|
||||
public $y = 0;
|
||||
public $z = 0;
|
||||
/** @var Vector3|null */
|
||||
public $position;
|
||||
/** @var int */
|
||||
public $data;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->evid = $this->getVarInt();
|
||||
$this->getVector3f($this->x, $this->y, $this->z);
|
||||
$this->position = $this->getVector3Obj();
|
||||
$this->data = $this->getVarInt();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putVarInt($this->evid);
|
||||
$this->putVector3f($this->x, $this->y, $this->z);
|
||||
$this->putVector3ObjNullable($this->position);
|
||||
$this->putVarInt($this->data);
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
|
||||
class LevelSoundEventPacket extends DataPacket{
|
||||
@ -192,18 +193,22 @@ class LevelSoundEventPacket extends DataPacket{
|
||||
const SOUND_DEFAULT = 161;
|
||||
const SOUND_UNDEFINED = 162;
|
||||
|
||||
/** @var int */
|
||||
public $sound;
|
||||
public $x;
|
||||
public $y;
|
||||
public $z;
|
||||
/** @var Vector3 */
|
||||
public $position;
|
||||
/** @var int */
|
||||
public $extraData = -1;
|
||||
/** @var int */
|
||||
public $pitch = 1;
|
||||
/** @var bool */
|
||||
public $unknownBool = false;
|
||||
/** @var bool */
|
||||
public $disableRelativeVolume = false;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->sound = $this->getByte();
|
||||
$this->getVector3f($this->x, $this->y, $this->z);
|
||||
$this->position = $this->getVector3Obj();
|
||||
$this->extraData = $this->getVarInt();
|
||||
$this->pitch = $this->getVarInt();
|
||||
$this->unknownBool = $this->getBool();
|
||||
@ -212,7 +217,7 @@ class LevelSoundEventPacket extends DataPacket{
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putByte($this->sound);
|
||||
$this->putVector3f($this->x, $this->y, $this->z);
|
||||
$this->putVector3Obj($this->position);
|
||||
$this->putVarInt($this->extraData);
|
||||
$this->putVarInt($this->pitch);
|
||||
$this->putBool($this->unknownBool);
|
||||
|
@ -34,14 +34,22 @@ class LoginPacket extends DataPacket{
|
||||
|
||||
const EDITION_POCKET = 0;
|
||||
|
||||
/** @var string */
|
||||
public $username;
|
||||
/** @var int */
|
||||
public $protocol;
|
||||
/** @var string */
|
||||
public $clientUUID;
|
||||
/** @var int */
|
||||
public $clientId;
|
||||
/** @var string */
|
||||
public $identityPublicKey;
|
||||
/** @var string */
|
||||
public $serverAddress;
|
||||
|
||||
/** @var string */
|
||||
public $skinId;
|
||||
/** @var string */
|
||||
public $skin = "";
|
||||
|
||||
/** @var array (the "chain" index contains one or more JWTs) */
|
||||
|
@ -32,6 +32,7 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class MapInfoRequestPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::MAP_INFO_REQUEST_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $mapId;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -32,24 +32,23 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class MobArmorEquipmentPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::MOB_ARMOR_EQUIPMENT_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
/** @var Item[] */
|
||||
public $slots = [];
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||
$this->slots[0] = $this->getSlot();
|
||||
$this->slots[1] = $this->getSlot();
|
||||
$this->slots[2] = $this->getSlot();
|
||||
$this->slots[3] = $this->getSlot();
|
||||
for($i = 0; $i < 4; ++$i){
|
||||
$this->slots[$i] = $this->getSlot();
|
||||
}
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$this->putSlot($this->slots[0]);
|
||||
$this->putSlot($this->slots[1]);
|
||||
$this->putSlot($this->slots[2]);
|
||||
$this->putSlot($this->slots[3]);
|
||||
for($i = 0; $i < 4; ++$i){
|
||||
$this->putSlot($this->slots[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -35,11 +35,17 @@ class MobEffectPacket extends DataPacket{
|
||||
const EVENT_MODIFY = 2;
|
||||
const EVENT_REMOVE = 3;
|
||||
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
/** @var int */
|
||||
public $eventId;
|
||||
/** @var int */
|
||||
public $effectId;
|
||||
/** @var int */
|
||||
public $amplifier = 0;
|
||||
/** @var bool */
|
||||
public $particles = true;
|
||||
/** @var int */
|
||||
public $duration = 0;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -26,15 +26,21 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
|
||||
class MobEquipmentPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::MOB_EQUIPMENT_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
/** @var Item */
|
||||
public $item;
|
||||
/** @var int */
|
||||
public $inventorySlot;
|
||||
/** @var int */
|
||||
public $hotbarSlot;
|
||||
/** @var int */
|
||||
public $windowId = 0;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -26,24 +26,30 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
|
||||
class MoveEntityPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::MOVE_ENTITY_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
public $x;
|
||||
public $y;
|
||||
public $z;
|
||||
/** @var Vector3 */
|
||||
public $position;
|
||||
/** @var float */
|
||||
public $yaw;
|
||||
/** @var float */
|
||||
public $headYaw;
|
||||
/** @var float */
|
||||
public $pitch;
|
||||
/** @var bool */
|
||||
public $onGround = false;
|
||||
/** @var bool */
|
||||
public $teleported = false;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||
$this->getVector3f($this->x, $this->y, $this->z);
|
||||
$this->position = $this->getVector3Obj();
|
||||
$this->pitch = $this->getByteRotation();
|
||||
$this->headYaw = $this->getByteRotation();
|
||||
$this->yaw = $this->getByteRotation();
|
||||
@ -53,7 +59,7 @@ class MoveEntityPacket extends DataPacket{
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$this->putVector3f($this->x, $this->y, $this->z);
|
||||
$this->putVector3Obj($this->position);
|
||||
$this->putByteRotation($this->pitch);
|
||||
$this->putByteRotation($this->headYaw);
|
||||
$this->putByteRotation($this->yaw);
|
||||
|
@ -26,6 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
|
||||
class MovePlayerPacket extends DataPacket{
|
||||
@ -36,22 +37,30 @@ class MovePlayerPacket extends DataPacket{
|
||||
const MODE_TELEPORT = 2;
|
||||
const MODE_PITCH = 3; //facepalm Mojang
|
||||
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
public $x;
|
||||
public $y;
|
||||
public $z;
|
||||
/** @var Vector3 */
|
||||
public $position;
|
||||
/** @var float */
|
||||
public $yaw;
|
||||
/** @var float */
|
||||
public $bodyYaw;
|
||||
/** @var float */
|
||||
public $pitch;
|
||||
/** @var int */
|
||||
public $mode = self::MODE_NORMAL;
|
||||
/** @var bool */
|
||||
public $onGround = false; //TODO
|
||||
/** @var int */
|
||||
public $ridingEid = 0;
|
||||
/** @var int */
|
||||
public $int1 = 0;
|
||||
/** @var int */
|
||||
public $int2 = 0;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||
$this->getVector3f($this->x, $this->y, $this->z);
|
||||
$this->position = $this->getVector3Obj();
|
||||
$this->pitch = $this->getLFloat();
|
||||
$this->yaw = $this->getLFloat();
|
||||
$this->bodyYaw = $this->getLFloat();
|
||||
@ -66,7 +75,7 @@ class MovePlayerPacket extends DataPacket{
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$this->putVector3f($this->x, $this->y, $this->z);
|
||||
$this->putVector3Obj($this->position);
|
||||
$this->putLFloat($this->pitch);
|
||||
$this->putLFloat($this->yaw);
|
||||
$this->putLFloat($this->bodyYaw); //TODO
|
||||
|
@ -32,11 +32,17 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class PlaySoundPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::PLAY_SOUND_PACKET;
|
||||
|
||||
/** @var string */
|
||||
public $soundName;
|
||||
/** @var int */
|
||||
public $x;
|
||||
/** @var int */
|
||||
public $y;
|
||||
/** @var int */
|
||||
public $z;
|
||||
/** @var float */
|
||||
public $volume;
|
||||
/** @var float */
|
||||
public $pitch;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -39,6 +39,7 @@ class PlayStatusPacket extends DataPacket{
|
||||
const LOGIN_FAILED_VANILLA_EDU = 5;
|
||||
const LOGIN_FAILED_EDU_VANILLA = 6;
|
||||
|
||||
/** @var int */
|
||||
public $status;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -54,11 +54,17 @@ class PlayerActionPacket extends DataPacket{
|
||||
|
||||
const ACTION_RELEASE_ITEM = 99999; //TODO REMOVE
|
||||
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
/** @var int */
|
||||
public $action;
|
||||
/** @var int */
|
||||
public $x;
|
||||
/** @var int */
|
||||
public $y;
|
||||
/** @var int */
|
||||
public $z;
|
||||
/** @var int */
|
||||
public $face;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -31,9 +31,13 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class PlayerInputPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::PLAYER_INPUT_PACKET;
|
||||
|
||||
/** @var float */
|
||||
public $motionX;
|
||||
/** @var float */
|
||||
public $motionY;
|
||||
/** @var bool */
|
||||
public $unknownBool1;
|
||||
/** @var bool */
|
||||
public $unknownBool2;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -37,6 +37,7 @@ class PlayerListPacket extends DataPacket{
|
||||
//REMOVE: UUID, ADD: UUID, entity id, name, skinId, skin, geometric model, geometry data
|
||||
/** @var array[] */
|
||||
public $entries = [];
|
||||
/** @var int */
|
||||
public $type;
|
||||
|
||||
public function clean(){
|
||||
|
@ -31,6 +31,7 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class RemoveEntityPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::REMOVE_ENTITY_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $entityUniqueId;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -31,6 +31,7 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class RequestChunkRadiusPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::REQUEST_CHUNK_RADIUS_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $radius;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -32,9 +32,13 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class ResourcePackChunkDataPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::RESOURCE_PACK_CHUNK_DATA_PACKET;
|
||||
|
||||
/** @var string */
|
||||
public $packId;
|
||||
/** @var int */
|
||||
public $chunkIndex;
|
||||
/** @var int */
|
||||
public $progress;
|
||||
/** @var string */
|
||||
public $data;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -32,7 +32,9 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class ResourcePackChunkRequestPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::RESOURCE_PACK_CHUNK_REQUEST_PACKET;
|
||||
|
||||
/** @var string */
|
||||
public $packId;
|
||||
/** @var int */
|
||||
public $chunkIndex;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -36,7 +36,9 @@ class ResourcePackClientResponsePacket extends DataPacket{
|
||||
const STATUS_HAVE_ALL_PACKS = 3;
|
||||
const STATUS_COMPLETED = 4;
|
||||
|
||||
/** @var int */
|
||||
public $status;
|
||||
/** @var string[] */
|
||||
public $packIds = [];
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -32,10 +32,15 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class ResourcePackDataInfoPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::RESOURCE_PACK_DATA_INFO_PACKET;
|
||||
|
||||
/** @var string */
|
||||
public $packId;
|
||||
/** @var int */
|
||||
public $maxChunkSize;
|
||||
/** @var int */
|
||||
public $chunkCount;
|
||||
/** @var int */
|
||||
public $compressedPackSize;
|
||||
/** @var string */
|
||||
public $sha256;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -34,6 +34,7 @@ use pocketmine\resourcepacks\ResourcePackInfoEntry;
|
||||
class ResourcePackStackPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::RESOURCE_PACK_STACK_PACKET;
|
||||
|
||||
/** @var bool */
|
||||
public $mustAccept = false;
|
||||
|
||||
/** @var ResourcePack[] */
|
||||
|
@ -33,6 +33,7 @@ use pocketmine\resourcepacks\ResourcePackInfoEntry;
|
||||
class ResourcePacksInfoPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::RESOURCE_PACKS_INFO_PACKET;
|
||||
|
||||
/** @var bool */
|
||||
public $mustAccept = false; //if true, forces client to use selected resource packs
|
||||
/** @var ResourcePack[] */
|
||||
public $behaviorPackEntries = [];
|
||||
|
@ -26,21 +26,21 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
|
||||
class RespawnPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::RESPAWN_PACKET;
|
||||
|
||||
public $x;
|
||||
public $y;
|
||||
public $z;
|
||||
/** @var Vector3 */
|
||||
public $position;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->getVector3f($this->x, $this->y, $this->z);
|
||||
$this->position = $this->getVector3Obj();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putVector3f($this->x, $this->y, $this->z);
|
||||
$this->putVector3Obj($this->position);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -32,6 +32,7 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class RiderJumpPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::RIDER_JUMP_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $unknown;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -31,6 +31,7 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class SetCommandsEnabledPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::SET_COMMANDS_ENABLED_PACKET;
|
||||
|
||||
/** @var bool */
|
||||
public $enabled;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -31,6 +31,7 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class SetDifficultyPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::SET_DIFFICULTY_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $difficulty;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -31,7 +31,9 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class SetEntityDataPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::SET_ENTITY_DATA_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
/** @var array */
|
||||
public $metadata;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -26,24 +26,25 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
|
||||
class SetEntityMotionPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::SET_ENTITY_MOTION_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
public $motionX;
|
||||
public $motionY;
|
||||
public $motionZ;
|
||||
/** @var Vector3 */
|
||||
public $motion;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||
$this->getVector3f($this->motionX, $this->motionY, $this->motionZ);
|
||||
$this->motion = $this->getVector3Obj();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$this->putVector3f($this->motionX, $this->motionY, $this->motionZ);
|
||||
$this->putVector3Obj($this->motion);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -31,6 +31,7 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class SetHealthPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::SET_HEALTH_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $health;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -30,6 +30,7 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class SetLastHurtByPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::SET_LAST_HURT_BY_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $entityTypeId;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -31,6 +31,7 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class SetPlayerGameTypePacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::SET_PLAYER_GAME_TYPE_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $gamemode;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -34,10 +34,15 @@ class SetSpawnPositionPacket extends DataPacket{
|
||||
const TYPE_PLAYER_SPAWN = 0;
|
||||
const TYPE_WORLD_SPAWN = 1;
|
||||
|
||||
/** @var int */
|
||||
public $spawnType;
|
||||
/** @var int */
|
||||
public $x;
|
||||
/** @var int */
|
||||
public $y;
|
||||
/** @var int */
|
||||
public $z;
|
||||
/** @var bool */
|
||||
public $spawnForced;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -30,6 +30,7 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class SetTimePacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::SET_TIME_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $time;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -39,10 +39,15 @@ class SetTitlePacket extends DataPacket{
|
||||
const TYPE_SET_ACTIONBAR_MESSAGE = 4;
|
||||
const TYPE_SET_ANIMATION_TIMES = 5;
|
||||
|
||||
/** @var int */
|
||||
public $type;
|
||||
/** @var string */
|
||||
public $text = "";
|
||||
/** @var int */
|
||||
public $fadeInTime = 0;
|
||||
/** @var int */
|
||||
public $stayTime = 0;
|
||||
/** @var int */
|
||||
public $fadeOutTime = 0;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -35,7 +35,9 @@ class ShowCreditsPacket extends DataPacket{
|
||||
const STATUS_START_CREDITS = 0;
|
||||
const STATUS_END_CREDITS = 1;
|
||||
|
||||
/** @var int */
|
||||
public $playerEid;
|
||||
/** @var int */
|
||||
public $status;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -30,8 +30,11 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class ShowStoreOfferPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::SHOW_STORE_OFFER_PACKET;
|
||||
|
||||
/** @var string */
|
||||
public $offerId;
|
||||
/** @var bool */
|
||||
public $unknownBool;
|
||||
/** @var string */
|
||||
public $unknownString;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -30,6 +30,7 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class SimpleEventPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::SIMPLE_EVENT_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $unknownShort1;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -26,23 +26,24 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
|
||||
class SpawnExperienceOrbPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::SPAWN_EXPERIENCE_ORB_PACKET;
|
||||
|
||||
public $x;
|
||||
public $y;
|
||||
public $z;
|
||||
/** @var Vector3 */
|
||||
public $position;
|
||||
/** @var int */
|
||||
public $amount;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->getVector3f($this->x, $this->y, $this->z);
|
||||
$this->position = $this->getVector3Obj();
|
||||
$this->amount = $this->getVarInt();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putVector3f($this->x, $this->y, $this->z);
|
||||
$this->putVector3Obj($this->position);
|
||||
$this->putVarInt($this->amount);
|
||||
}
|
||||
|
||||
|
@ -26,54 +26,88 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
use pocketmine\network\mcpe\protocol\types\PlayerPermissions;
|
||||
|
||||
class StartGamePacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::START_GAME_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $entityUniqueId;
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
/** @var int */
|
||||
public $playerGamemode;
|
||||
|
||||
public $x;
|
||||
public $y;
|
||||
public $z;
|
||||
/** @var Vector3 */
|
||||
public $playerPosition;
|
||||
|
||||
/** @var float */
|
||||
public $pitch;
|
||||
/** @var float */
|
||||
public $yaw;
|
||||
|
||||
/** @var int */
|
||||
public $seed;
|
||||
/** @var int */
|
||||
public $dimension;
|
||||
/** @var int */
|
||||
public $generator = 1; //default infinite - 0 old, 1 infinite, 2 flat
|
||||
/** @var int */
|
||||
public $worldGamemode;
|
||||
/** @var int */
|
||||
public $difficulty;
|
||||
/** @var int */
|
||||
public $spawnX;
|
||||
/** @var int*/
|
||||
public $spawnY;
|
||||
/** @var int */
|
||||
public $spawnZ;
|
||||
/** @var bool */
|
||||
public $hasAchievementsDisabled = true;
|
||||
/** @var int */
|
||||
public $time = -1;
|
||||
/** @var bool */
|
||||
public $eduMode = false;
|
||||
/** @var float */
|
||||
public $rainLevel;
|
||||
/** @var float */
|
||||
public $lightningLevel;
|
||||
/** @var bool */
|
||||
public $isMultiplayerGame = true;
|
||||
/** @var bool */
|
||||
public $hasLANBroadcast = true;
|
||||
/** @var bool */
|
||||
public $hasXboxLiveBroadcast = false;
|
||||
/** @var bool */
|
||||
public $commandsEnabled;
|
||||
/** @var bool */
|
||||
public $isTexturePacksRequired = true;
|
||||
/** @var array */
|
||||
public $gameRules = []; //TODO: implement this
|
||||
/** @var bool */
|
||||
public $hasBonusChestEnabled = false;
|
||||
/** @var bool */
|
||||
public $hasStartWithMapEnabled = false;
|
||||
/** @var bool */
|
||||
public $hasTrustPlayersEnabled = false;
|
||||
/** @var int */
|
||||
public $defaultPlayerPermission = PlayerPermissions::MEMBER; //TODO
|
||||
/** @var int */
|
||||
public $xboxLiveBroadcastMode = 0; //TODO: find values
|
||||
|
||||
/** @var string */
|
||||
public $levelId = ""; //base64 string, usually the same as world folder name in vanilla
|
||||
/** @var string */
|
||||
public $worldName;
|
||||
/** @var string */
|
||||
public $premiumWorldTemplateId = "";
|
||||
/** @var bool */
|
||||
public $unknownBool = false;
|
||||
/** @var int */
|
||||
public $currentTick = 0;
|
||||
|
||||
/** @var int */
|
||||
public $unknownVarInt = 0;
|
||||
|
||||
protected function decodePayload(){
|
||||
@ -81,7 +115,7 @@ class StartGamePacket extends DataPacket{
|
||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||
$this->playerGamemode = $this->getVarInt();
|
||||
|
||||
$this->getVector3f($this->x, $this->y, $this->z);
|
||||
$this->playerPosition = $this->getVector3Obj();
|
||||
|
||||
$this->pitch = $this->getLFloat();
|
||||
$this->yaw = $this->getLFloat();
|
||||
@ -124,7 +158,7 @@ class StartGamePacket extends DataPacket{
|
||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$this->putVarInt($this->playerGamemode);
|
||||
|
||||
$this->putVector3f($this->x, $this->y, $this->z);
|
||||
$this->putVector3Obj($this->playerPosition);
|
||||
|
||||
$this->putLFloat($this->pitch);
|
||||
$this->putLFloat($this->yaw);
|
||||
|
@ -32,7 +32,9 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class StopSoundPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::STOP_SOUND_PACKET;
|
||||
|
||||
/** @var string */
|
||||
public $soundName;
|
||||
/** @var bool */
|
||||
public $stopAll;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -31,7 +31,9 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class TakeItemEntityPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::TAKE_ITEM_ENTITY_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $target;
|
||||
/** @var int */
|
||||
public $eid;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -30,7 +30,9 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class TransferPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::TRANSFER_PACKET;
|
||||
|
||||
/** @var string */
|
||||
public $address;
|
||||
/** @var int */
|
||||
public $port = 19132;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -30,6 +30,7 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class UnknownPacket extends DataPacket{
|
||||
const NETWORK_ID = -1; //Invalid, do not try to write this
|
||||
|
||||
/** @var string */
|
||||
public $payload;
|
||||
|
||||
public function pid(){
|
||||
|
@ -32,6 +32,7 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class UpdateAttributesPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::UPDATE_ATTRIBUTES_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
/** @var Attribute[] */
|
||||
public $entries = [];
|
||||
|
@ -40,11 +40,17 @@ class UpdateBlockPacket extends DataPacket{
|
||||
const FLAG_ALL = self::FLAG_NEIGHBORS | self::FLAG_NETWORK;
|
||||
const FLAG_ALL_PRIORITY = self::FLAG_ALL | self::FLAG_PRIORITY;
|
||||
|
||||
/** @var int */
|
||||
public $x;
|
||||
/** @var int */
|
||||
public $z;
|
||||
/** @var int */
|
||||
public $y;
|
||||
/** @var int */
|
||||
public $blockId;
|
||||
/** @var int */
|
||||
public $blockData;
|
||||
/** @var int */
|
||||
public $flags;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -30,10 +30,15 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class UpdateEquipPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::UPDATE_EQUIP_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $windowId;
|
||||
/** @var int */
|
||||
public $windowType;
|
||||
/** @var int */
|
||||
public $unknownVarint; //TODO: find out what this is (vanilla always sends 0)
|
||||
/** @var int */
|
||||
public $entityUniqueId;
|
||||
/** @var string */
|
||||
public $namedtag;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -34,14 +34,24 @@ class UpdateTradePacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::UPDATE_TRADE_PACKET;
|
||||
|
||||
//TODO: find fields
|
||||
|
||||
/** @var int */
|
||||
public $windowId;
|
||||
/** @var int */
|
||||
public $windowType = WindowTypes::TRADING; //Mojang hardcoded this -_-
|
||||
/** @var int */
|
||||
public $varint1;
|
||||
/** @var int */
|
||||
public $varint2;
|
||||
/** @var bool */
|
||||
public $isWilling;
|
||||
/** @var int */
|
||||
public $traderEid;
|
||||
/** @var int */
|
||||
public $playerEid;
|
||||
/** @var string */
|
||||
public $displayName;
|
||||
/** @var string */
|
||||
public $offers;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
Loading…
x
Reference in New Issue
Block a user