mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-20 20:48:06 +00:00
Moved network ids to constants, improved some entity methods, more performance
This commit is contained in:
parent
32680843fa
commit
9e14435dbb
@ -159,8 +159,8 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
|
|
||||||
protected $sendIndex = 0;
|
protected $sendIndex = 0;
|
||||||
|
|
||||||
protected $moveToSend = [];
|
protected $moveToSend;
|
||||||
protected $motionToSend = [];
|
protected $motionToSend;
|
||||||
|
|
||||||
/** @var Vector3 */
|
/** @var Vector3 */
|
||||||
public $speed = null;
|
public $speed = null;
|
||||||
@ -502,11 +502,16 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
$this->spawnThreshold = (int) $this->server->getProperty("chunk-sending.spawn-threshold", 56);
|
$this->spawnThreshold = (int) $this->server->getProperty("chunk-sending.spawn-threshold", 56);
|
||||||
$this->spawnPosition = null;
|
$this->spawnPosition = null;
|
||||||
$this->gamemode = $this->server->getGamemode();
|
$this->gamemode = $this->server->getGamemode();
|
||||||
$this->setLevel($this->server->getDefaultLevel(), true);
|
$this->setLevel($this->server->getDefaultLevel());
|
||||||
$this->viewDistance = $this->server->getViewDistance();
|
$this->viewDistance = $this->server->getViewDistance();
|
||||||
$this->newPosition = new Vector3(0, 0, 0);
|
$this->newPosition = new Vector3(0, 0, 0);
|
||||||
$this->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
|
$this->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
$this->motionToSend = new SetEntityMotionPacket();
|
||||||
|
$this->moveToSend = new MoveEntityPacket();
|
||||||
|
$this->motionToSend->setChannel(Network::CHANNEL_MOVEMENT);
|
||||||
|
$this->moveToSend->setChannel(Network::CHANNEL_MOVEMENT);
|
||||||
|
|
||||||
$this->uuid = Utils::dataToUUID($ip, $port, $clientID);
|
$this->uuid = Utils::dataToUUID($ip, $port, $clientID);
|
||||||
|
|
||||||
$this->creationTime = microtime(true);
|
$this->creationTime = microtime(true);
|
||||||
@ -1168,11 +1173,40 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function addEntityMotion($entityId, $x, $y, $z){
|
public function addEntityMotion($entityId, $x, $y, $z){
|
||||||
$this->motionToSend[$entityId] = [$entityId, $x, $y, $z];
|
$this->motionToSend->entities[$entityId] = [$entityId, $x, $y, $z];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addEntityMovement($entityId, $x, $y, $z, $yaw, $pitch, $headYaw = null){
|
public function addEntityMovement($entityId, $x, $y, $z, $yaw, $pitch, $headYaw = null){
|
||||||
$this->moveToSend[$entityId] = [$entityId, $x, $y, $z, $yaw, $headYaw === null ? $yaw : $headYaw, $pitch];
|
$this->moveToSend->entities[$entityId] = [$entityId, $x, $y, $z, $yaw, $headYaw === null ? $yaw : $headYaw, $pitch];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDataProperty($id, $type, $value){
|
||||||
|
if(parent::setDataProperty($id, $type, $value)){
|
||||||
|
$this->sendData([$this], [$id => $this->dataProperties[$id]]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function checkGroundState($movX, $movY, $movZ, $dx, $dy, $dz){
|
||||||
|
if(!$this->onGround or $movY != 0){
|
||||||
|
$bb = clone $this->boundingBox;
|
||||||
|
$bb->maxY = $bb->minY + 0.5;
|
||||||
|
$bb->minY -= 1;
|
||||||
|
if(count($this->level->getCollisionBlocks($bb, true)) > 0){
|
||||||
|
$this->onGround = true;
|
||||||
|
}else{
|
||||||
|
$this->onGround = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->isCollided = $this->onGround;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function checkBlockCollision(){
|
||||||
|
foreach($this->getBlocksAround() as $block){
|
||||||
|
$block->onEntityCollide($this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function checkNearEntities($tickDiff){
|
protected function checkNearEntities($tickDiff){
|
||||||
@ -1418,7 +1452,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
}else{
|
}else{
|
||||||
if(!$this->allowFlight and $this->inAirTicks > 10 and !$this->isSleeping() and $this->getDataProperty(self::DATA_NO_AI) !== 1){
|
if(!$this->allowFlight and $this->inAirTicks > 10 and !$this->isSleeping() and $this->getDataProperty(self::DATA_NO_AI) !== 1){
|
||||||
$expectedVelocity = (-$this->gravity) / $this->drag - ((-$this->gravity) / $this->drag) * exp(-$this->drag * ($this->inAirTicks - $this->startAirTicks));
|
$expectedVelocity = (-$this->gravity) / $this->drag - ((-$this->gravity) / $this->drag) * exp(-$this->drag * ($this->inAirTicks - $this->startAirTicks));
|
||||||
$diff = sqrt(abs($this->speed->y - $expectedVelocity));
|
$diff = ($this->speed->y - $expectedVelocity) ** 2;
|
||||||
|
|
||||||
if(!$this->hasEffect(Effect::JUMP) and $diff > 0.6 and $expectedVelocity < $this->speed->y and !$this->server->getAllowFlight()){
|
if(!$this->hasEffect(Effect::JUMP) and $diff > 0.6 and $expectedVelocity < $this->speed->y and !$this->server->getAllowFlight()){
|
||||||
if($this->inAirTicks < 100){
|
if($this->inAirTicks < 100){
|
||||||
@ -1442,19 +1476,17 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
$this->sendNextChunk();
|
$this->sendNextChunk();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($this->moveToSend) > 0){
|
if(count($this->moveToSend->entities) > 0){
|
||||||
$pk = new MoveEntityPacket();
|
$this->dataPacket($this->moveToSend);
|
||||||
$pk->entities = $this->moveToSend;
|
$this->moveToSend->entities = [];
|
||||||
$this->batchDataPacket($pk->setChannel(Network::CHANNEL_MOVEMENT));
|
$this->moveToSend->isEncoded = false;
|
||||||
$this->moveToSend = [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(count($this->motionToSend) > 0){
|
if(count($this->motionToSend->entities) > 0){
|
||||||
$pk = new SetEntityMotionPacket();
|
$this->dataPacket($this->motionToSend);
|
||||||
$pk->entities = $this->motionToSend;
|
$this->motionToSend->entities = [];
|
||||||
$this->batchDataPacket($pk->setChannel(Network::CHANNEL_MOVEMENT));
|
$this->motionToSend->isEncoded = false;
|
||||||
$this->motionToSend = [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($this->batchedPackets) > 0){
|
if(count($this->batchedPackets) > 0){
|
||||||
@ -1496,7 +1528,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($packet->pid() === ProtocolInfo::BATCH_PACKET){
|
if($packet::NETWORK_ID === ProtocolInfo::BATCH_PACKET){
|
||||||
/** @var BatchPacket $packet */
|
/** @var BatchPacket $packet */
|
||||||
$this->server->getNetwork()->processBatch($packet, $this);
|
$this->server->getNetwork()->processBatch($packet, $this);
|
||||||
return;
|
return;
|
||||||
@ -1507,7 +1539,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($packet->pid()){
|
switch($packet::NETWORK_ID){
|
||||||
case ProtocolInfo::LOGIN_PACKET:
|
case ProtocolInfo::LOGIN_PACKET:
|
||||||
if($this->loggedIn){
|
if($this->loggedIn){
|
||||||
break;
|
break;
|
||||||
@ -3097,7 +3129,6 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
|
|
||||||
|
|
||||||
$this->resetFallDistance();
|
$this->resetFallDistance();
|
||||||
$this->orderChunks();
|
|
||||||
$this->nextChunkOrderRun = 0;
|
$this->nextChunkOrderRun = 0;
|
||||||
$this->newPosition = null;
|
$this->newPosition = null;
|
||||||
}
|
}
|
||||||
|
@ -1408,7 +1408,7 @@ class Server{
|
|||||||
public function addOp($name){
|
public function addOp($name){
|
||||||
$this->operators->set(strtolower($name), true);
|
$this->operators->set(strtolower($name), true);
|
||||||
|
|
||||||
if(($player = $this->getPlayerExact($name)) instanceof Player){
|
if(($player = $this->getPlayerExact($name)) !== null){
|
||||||
$player->recalculatePermissions();
|
$player->recalculatePermissions();
|
||||||
}
|
}
|
||||||
$this->operators->save(true);
|
$this->operators->save(true);
|
||||||
@ -1420,7 +1420,7 @@ class Server{
|
|||||||
public function removeOp($name){
|
public function removeOp($name){
|
||||||
$this->operators->remove(strtolower($name));
|
$this->operators->remove(strtolower($name));
|
||||||
|
|
||||||
if(($player = $this->getPlayerExact($name)) instanceof Player){
|
if(($player = $this->getPlayerExact($name)) !== null){
|
||||||
$player->recalculatePermissions();
|
$player->recalculatePermissions();
|
||||||
}
|
}
|
||||||
$this->operators->save();
|
$this->operators->save();
|
||||||
|
@ -129,6 +129,9 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
|
|
||||||
protected $lastDamageCause = null;
|
protected $lastDamageCause = null;
|
||||||
|
|
||||||
|
/** @var Block[] */
|
||||||
|
private $blocksAround = [];
|
||||||
|
|
||||||
public $lastX = null;
|
public $lastX = null;
|
||||||
public $lastY = null;
|
public $lastY = null;
|
||||||
public $lastZ = null;
|
public $lastZ = null;
|
||||||
@ -198,6 +201,7 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
|
|
||||||
/** @var \pocketmine\event\TimingsHandler */
|
/** @var \pocketmine\event\TimingsHandler */
|
||||||
protected $timings;
|
protected $timings;
|
||||||
|
protected $isPlayer = false;
|
||||||
|
|
||||||
|
|
||||||
public function __construct(FullChunk $chunk, Compound $nbt){
|
public function __construct(FullChunk $chunk, Compound $nbt){
|
||||||
@ -207,6 +211,8 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
|
|
||||||
$this->timings = Timings::getEntityTimings($this);
|
$this->timings = Timings::getEntityTimings($this);
|
||||||
|
|
||||||
|
$this->isPlayer = $this instanceof Player;
|
||||||
|
|
||||||
$this->temporalVector = new Vector3();
|
$this->temporalVector = new Vector3();
|
||||||
|
|
||||||
if($this->eyeHeight === null){
|
if($this->eyeHeight === null){
|
||||||
@ -537,7 +543,7 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
* @param array $data Properly formatted entity data, defaults to everything
|
* @param array $data Properly formatted entity data, defaults to everything
|
||||||
*/
|
*/
|
||||||
public function sendData($player, array $data = null){
|
public function sendData($player, array $data = null){
|
||||||
if($player instanceof Player){
|
if(!is_array($player)){
|
||||||
$player = [$player];
|
$player = [$player];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -757,13 +763,13 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
Timings::$timerEntityBaseTick->startTiming();
|
Timings::$timerEntityBaseTick->startTiming();
|
||||||
//TODO: check vehicles
|
//TODO: check vehicles
|
||||||
|
|
||||||
|
$this->blocksAround = null;
|
||||||
$this->justCreated = false;
|
$this->justCreated = false;
|
||||||
$isPlayer = $this instanceof Player;
|
|
||||||
|
|
||||||
if(!$this->isAlive()){
|
if(!$this->isAlive()){
|
||||||
$this->removeAllEffects();
|
$this->removeAllEffects();
|
||||||
$this->despawnFromAll();
|
$this->despawnFromAll();
|
||||||
if(!$isPlayer){
|
if(!$this->isPlayer){
|
||||||
$this->close();
|
$this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -844,12 +850,10 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
$this->lastYaw = $this->yaw;
|
$this->lastYaw = $this->yaw;
|
||||||
$this->lastPitch = $this->pitch;
|
$this->lastPitch = $this->pitch;
|
||||||
|
|
||||||
if(!($this instanceof Player)){
|
|
||||||
foreach($this->hasSpawned as $player){
|
foreach($this->hasSpawned as $player){
|
||||||
$player->addEntityMovement($this->id, $this->x, $this->y + $this->getEyeHeight(), $this->z, $this->yaw, $this->pitch, $this->yaw);
|
$player->addEntityMovement($this->id, $this->x, $this->y + $this->getEyeHeight(), $this->z, $this->yaw, $this->pitch, $this->yaw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if($diffMotion > 0.0025 or ($diffMotion > 0.0001 and $this->getMotion()->lengthSquared() <= 0.0001)){ //0.05 ** 2
|
if($diffMotion > 0.0025 or ($diffMotion > 0.0001 and $this->getMotion()->lengthSquared() <= 0.0001)){ //0.05 ** 2
|
||||||
$this->lastMotionX = $this->motionX;
|
$this->lastMotionX = $this->motionX;
|
||||||
@ -859,12 +863,6 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
foreach($this->hasSpawned as $player){
|
foreach($this->hasSpawned as $player){
|
||||||
$player->addEntityMotion($this->id, $this->motionX, $this->motionY, $this->motionZ);
|
$player->addEntityMotion($this->id, $this->motionX, $this->motionY, $this->motionZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this instanceof Player){
|
|
||||||
$this->motionX = 0;
|
|
||||||
$this->motionY = 0;
|
|
||||||
$this->motionZ = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -893,7 +891,7 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
++$this->deadTicks;
|
++$this->deadTicks;
|
||||||
if($this->deadTicks >= 10){
|
if($this->deadTicks >= 10){
|
||||||
$this->despawnFromAll();
|
$this->despawnFromAll();
|
||||||
if(!($this instanceof Player)){
|
if(!$this->isPlayer){
|
||||||
$this->close();
|
$this->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1076,11 +1074,9 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
|
|
||||||
Timings::$entityMoveTimer->startTiming();
|
Timings::$entityMoveTimer->startTiming();
|
||||||
|
|
||||||
$axisalignedbb = clone $this->boundingBox;
|
|
||||||
|
|
||||||
$newBB = $this->boundingBox->getOffsetBoundingBox($dx, $dy, $dz);
|
$newBB = $this->boundingBox->getOffsetBoundingBox($dx, $dy, $dz);
|
||||||
|
|
||||||
$list = $this->level->getCollisionCubes($this, $newBB->grow(-0.01, -0.01, -0.01), false);
|
$list = $this->level->getCollisionCubes($this, $newBB, false);
|
||||||
|
|
||||||
if(count($list) === 0){
|
if(count($list) === 0){
|
||||||
$this->boundingBox = $newBB;
|
$this->boundingBox = $newBB;
|
||||||
@ -1119,7 +1115,7 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
if($this->keepMovement){
|
if($this->keepMovement){
|
||||||
$this->boundingBox->offset($dx, $dy, $dz);
|
$this->boundingBox->offset($dx, $dy, $dz);
|
||||||
$this->setPosition($this->temporalVector->setComponents(($this->boundingBox->minX + $this->boundingBox->maxX) / 2, $this->boundingBox->minY, ($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2));
|
$this->setPosition($this->temporalVector->setComponents(($this->boundingBox->minX + $this->boundingBox->maxX) / 2, $this->boundingBox->minY, ($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2));
|
||||||
$this->onGround = $this instanceof Player ? true : false;
|
$this->onGround = $this->isPlayer ? true : false;
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
@ -1243,24 +1239,7 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
|
|
||||||
$this->checkChunks();
|
$this->checkChunks();
|
||||||
|
|
||||||
if($this instanceof Player){
|
$this->checkGroundState($movX, $movY, $movZ, $dx, $dy, $dz);
|
||||||
if(!$this->onGround or $movY != 0){
|
|
||||||
$bb = clone $this->boundingBox;
|
|
||||||
$bb->maxY = $bb->minY + 0.5;
|
|
||||||
$bb->minY -= 1;
|
|
||||||
if(count($this->level->getCollisionBlocks($bb)) > 0){
|
|
||||||
$this->onGround = true;
|
|
||||||
}else{
|
|
||||||
$this->onGround = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$this->isCollided = $this->onGround;
|
|
||||||
}else{
|
|
||||||
$this->isCollidedVertically = $movY != $dy;
|
|
||||||
$this->isCollidedHorizontally = ($movX != $dx or $movZ != $dz);
|
|
||||||
$this->isCollided = ($this->isCollidedHorizontally or $this->isCollidedVertically);
|
|
||||||
$this->onGround = ($movY != $dy and $movY < 0);
|
|
||||||
}
|
|
||||||
$this->updateFallState($dy, $this->onGround);
|
$this->updateFallState($dy, $this->onGround);
|
||||||
|
|
||||||
if($movX != $dx){
|
if($movX != $dx){
|
||||||
@ -1284,32 +1263,48 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function checkBlockCollision(){
|
protected function checkGroundState($movX, $movY, $movZ, $dx, $dy, $dz){
|
||||||
$minX = Math::floorFloat($this->boundingBox->minX + 0.001);
|
$this->isCollidedVertically = $movY != $dy;
|
||||||
$minY = Math::floorFloat($this->boundingBox->minY + 0.001);
|
$this->isCollidedHorizontally = ($movX != $dx or $movZ != $dz);
|
||||||
$minZ = Math::floorFloat($this->boundingBox->minZ + 0.001);
|
$this->isCollided = ($this->isCollidedHorizontally or $this->isCollidedVertically);
|
||||||
$maxX = Math::ceilFloat($this->boundingBox->maxX - 0.001);
|
$this->onGround = ($movY != $dy and $movY < 0);
|
||||||
$maxY = Math::ceilFloat($this->boundingBox->maxY - 0.001);
|
}
|
||||||
$maxZ = Math::ceilFloat($this->boundingBox->maxZ - 0.001);
|
|
||||||
|
|
||||||
$vector = new Vector3(0, 0, 0);
|
public function getBlocksAround(){
|
||||||
$v = new Vector3(0, 0, 0);
|
if($this->blocksAround === null){
|
||||||
|
$minX = Math::floorFloat($this->boundingBox->minX);
|
||||||
|
$minY = Math::floorFloat($this->boundingBox->minY);
|
||||||
|
$minZ = Math::floorFloat($this->boundingBox->minZ);
|
||||||
|
$maxX = Math::ceilFloat($this->boundingBox->maxX);
|
||||||
|
$maxY = Math::ceilFloat($this->boundingBox->maxY);
|
||||||
|
$maxZ = Math::ceilFloat($this->boundingBox->maxZ);
|
||||||
|
|
||||||
for($v->z = $minZ; $v->z <= $maxZ; ++$v->z){
|
$this->blocksAround = [];
|
||||||
for($v->x = $minX; $v->x <= $maxX; ++$v->x){
|
|
||||||
for($v->y = $minY; $v->y <= $maxY; ++$v->y){
|
for($z = $minZ; $z <= $maxZ; ++$z){
|
||||||
$block = $this->level->getBlock($v);
|
for($x = $minX; $x <= $maxX; ++$x){
|
||||||
|
for($y = $minY; $y <= $maxY; ++$y){
|
||||||
|
$block = $this->level->getBlock($this->temporalVector->setComponents($x, $y, $z));
|
||||||
if($block->hasEntityCollision()){
|
if($block->hasEntityCollision()){
|
||||||
|
$this->blocksAround[] = $block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->blocksAround;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function checkBlockCollision(){
|
||||||
|
$vector = new Vector3(0, 0, 0);
|
||||||
|
|
||||||
|
foreach($this->getBlocksAround() as $block){
|
||||||
$block->onEntityCollide($this);
|
$block->onEntityCollide($this);
|
||||||
if(!($this instanceof Player)){
|
|
||||||
$block->addVelocityToEntity($this, $vector);
|
$block->addVelocityToEntity($this, $vector);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!($this instanceof Player) and $vector->lengthSquared() > 0){
|
if($vector->lengthSquared() > 0){
|
||||||
$vector = $vector->normalize();
|
$vector = $vector->normalize();
|
||||||
$d = 0.014;
|
$d = 0.014;
|
||||||
$this->motionX += $vector->x * $d;
|
$this->motionX += $vector->x * $d;
|
||||||
@ -1508,21 +1503,19 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
* @param int $id
|
* @param int $id
|
||||||
* @param int $type
|
* @param int $type
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function setDataProperty($id, $type, $value){
|
public function setDataProperty($id, $type, $value){
|
||||||
if($this->getDataProperty($id) !== $value){
|
if($this->getDataProperty($id) !== $value){
|
||||||
$this->dataProperties[$id] = [$type, $value];
|
$this->dataProperties[$id] = [$type, $value];
|
||||||
|
|
||||||
$targets = $this->hasSpawned;
|
$this->sendData($this->hasSpawned, [$id => $this->dataProperties[$id]]);
|
||||||
if($this instanceof Player){
|
|
||||||
if(!$this->spawned){
|
return true;
|
||||||
return;
|
|
||||||
}
|
|
||||||
$targets[] = $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->sendData($targets, [$id => $this->dataProperties[$id]]);
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -115,7 +115,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
|||||||
|
|
||||||
public function getDrops(){
|
public function getDrops(){
|
||||||
$drops = [];
|
$drops = [];
|
||||||
if($this->inventory instanceof PlayerInventory){
|
if($this->inventory !== null){
|
||||||
foreach($this->inventory->getContents() as $item){
|
foreach($this->inventory->getContents() as $item){
|
||||||
$drops[] = $item;
|
$drops[] = $item;
|
||||||
}
|
}
|
||||||
@ -128,7 +128,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
|||||||
parent::saveNBT();
|
parent::saveNBT();
|
||||||
$this->namedtag->Inventory = new Enum("Inventory", []);
|
$this->namedtag->Inventory = new Enum("Inventory", []);
|
||||||
$this->namedtag->Inventory->setTagType(NBT::TAG_Compound);
|
$this->namedtag->Inventory->setTagType(NBT::TAG_Compound);
|
||||||
if($this->inventory instanceof PlayerInventory){
|
if($this->inventory !== null){
|
||||||
for($slot = 0; $slot < 9; ++$slot){
|
for($slot = 0; $slot < 9; ++$slot){
|
||||||
$hotbarSlot = $this->inventory->getHotbarSlotIndex($slot);
|
$hotbarSlot = $this->inventory->getHotbarSlotIndex($slot);
|
||||||
if($hotbarSlot !== -1){
|
if($hotbarSlot !== -1){
|
||||||
|
@ -76,10 +76,8 @@ class PlayerChatEvent extends PlayerEvent implements Cancellable{
|
|||||||
* @param Player $player
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function setPlayer(Player $player){
|
public function setPlayer(Player $player){
|
||||||
if($player instanceof Player){
|
|
||||||
$this->player = $player;
|
$this->player = $player;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormat(){
|
public function getFormat(){
|
||||||
return $this->format;
|
return $this->format;
|
||||||
|
@ -988,10 +988,11 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param AxisAlignedBB $bb
|
* @param AxisAlignedBB $bb
|
||||||
|
* @param bool $targetFirst
|
||||||
*
|
*
|
||||||
* @return Block[]
|
* @return Block[]
|
||||||
*/
|
*/
|
||||||
public function getCollisionBlocks(AxisAlignedBB $bb){
|
public function getCollisionBlocks(AxisAlignedBB $bb, $targetFirst = false){
|
||||||
$minX = Math::floorFloat($bb->minX);
|
$minX = Math::floorFloat($bb->minX);
|
||||||
$minY = Math::floorFloat($bb->minY);
|
$minY = Math::floorFloat($bb->minY);
|
||||||
$minZ = Math::floorFloat($bb->minZ);
|
$minZ = Math::floorFloat($bb->minZ);
|
||||||
@ -1001,6 +1002,18 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
|
|
||||||
$collides = [];
|
$collides = [];
|
||||||
|
|
||||||
|
if($targetFirst){
|
||||||
|
for($z = $minZ; $z <= $maxZ; ++$z){
|
||||||
|
for($x = $minX; $x <= $maxX; ++$x){
|
||||||
|
for($y = $minY; $y <= $maxY; ++$y){
|
||||||
|
$block = $this->getBlock($this->temporalVector->setComponents($x, $y, $z));
|
||||||
|
if($block->getId() !== 0 and $block->collidesWithBB($bb)){
|
||||||
|
return [$block];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
for($z = $minZ; $z <= $maxZ; ++$z){
|
for($z = $minZ; $z <= $maxZ; ++$z){
|
||||||
for($x = $minX; $x <= $maxX; ++$x){
|
for($x = $minX; $x <= $maxX; ++$x){
|
||||||
for($y = $minY; $y <= $maxY; ++$y){
|
for($y = $minY; $y <= $maxY; ++$y){
|
||||||
@ -1011,6 +1024,8 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return $collides;
|
return $collides;
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ class Network{
|
|||||||
try{
|
try{
|
||||||
while($offset < $len){
|
while($offset < $len){
|
||||||
if(($pk = $this->getPacket(ord($str{$offset++}))) !== null){
|
if(($pk = $this->getPacket(ord($str{$offset++}))) !== null){
|
||||||
if($pk->pid() === Info::BATCH_PACKET){
|
if($pk::NETWORK_ID === Info::BATCH_PACKET){
|
||||||
throw new \InvalidStateException("Invalid BatchPacket inside BatchPacket");
|
throw new \InvalidStateException("Invalid BatchPacket inside BatchPacket");
|
||||||
}
|
}
|
||||||
$pk->setBuffer($str, $offset);
|
$pk->setBuffer($str, $offset);
|
||||||
|
@ -25,7 +25,6 @@ use pocketmine\event\player\PlayerCreationEvent;
|
|||||||
use pocketmine\network\protocol\DataPacket;
|
use pocketmine\network\protocol\DataPacket;
|
||||||
use pocketmine\network\protocol\Info as ProtocolInfo;
|
use pocketmine\network\protocol\Info as ProtocolInfo;
|
||||||
use pocketmine\network\protocol\Info;
|
use pocketmine\network\protocol\Info;
|
||||||
use pocketmine\network\protocol\UnknownPacket;
|
|
||||||
use pocketmine\Player;
|
use pocketmine\Player;
|
||||||
use pocketmine\Server;
|
use pocketmine\Server;
|
||||||
use pocketmine\utils\MainLogger;
|
use pocketmine\utils\MainLogger;
|
||||||
@ -136,9 +135,11 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
|
|||||||
try{
|
try{
|
||||||
if($packet->buffer !== ""){
|
if($packet->buffer !== ""){
|
||||||
$pk = $this->getPacket($packet->buffer);
|
$pk = $this->getPacket($packet->buffer);
|
||||||
|
if($pk !== null){
|
||||||
$pk->decode();
|
$pk->decode();
|
||||||
$this->players[$identifier]->handleDataPacket($pk);
|
$this->players[$identifier]->handleDataPacket($pk);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}catch(\Exception $e){
|
}catch(\Exception $e){
|
||||||
if(\pocketmine\DEBUG > 1 and isset($pk)){
|
if(\pocketmine\DEBUG > 1 and isset($pk)){
|
||||||
$logger = $this->server->getLogger();
|
$logger = $this->server->getLogger();
|
||||||
@ -216,7 +217,7 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
|
|||||||
$pk = $packet->__encapsulatedPacket;
|
$pk = $packet->__encapsulatedPacket;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$immediate and !$needACK and $packet->pid() !== ProtocolInfo::BATCH_PACKET
|
if(!$immediate and !$needACK and $packet::NETWORK_ID !== ProtocolInfo::BATCH_PACKET
|
||||||
and Network::$BATCH_THRESHOLD >= 0
|
and Network::$BATCH_THRESHOLD >= 0
|
||||||
and strlen($packet->buffer) >= Network::$BATCH_THRESHOLD){
|
and strlen($packet->buffer) >= Network::$BATCH_THRESHOLD){
|
||||||
$this->server->batchPackets([$player], [$packet], true, $packet->getChannel());
|
$this->server->batchPackets([$player], [$packet], true, $packet->getChannel());
|
||||||
@ -251,8 +252,7 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
|
|||||||
$pid = ord($buffer{0});
|
$pid = ord($buffer{0});
|
||||||
|
|
||||||
if(($data = $this->network->getPacket($pid)) === null){
|
if(($data = $this->network->getPacket($pid)) === null){
|
||||||
$data = new UnknownPacket();
|
return null;
|
||||||
$data->packetID = $pid;
|
|
||||||
}
|
}
|
||||||
$data->setBuffer($buffer, 1);
|
$data->setBuffer($buffer, 1);
|
||||||
|
|
||||||
|
@ -29,8 +29,7 @@ use pocketmine\utils\Binary;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
class AddEntityPacket extends DataPacket{
|
class AddEntityPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::ADD_ENTITY_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $eid;
|
public $eid;
|
||||||
public $type;
|
public $type;
|
||||||
@ -45,10 +44,6 @@ class AddEntityPacket extends DataPacket{
|
|||||||
public $metadata;
|
public $metadata;
|
||||||
public $links = [];
|
public $links = [];
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::ADD_ENTITY_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class AddItemEntityPacket extends DataPacket{
|
class AddItemEntityPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::ADD_ITEM_ENTITY_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $eid;
|
public $eid;
|
||||||
public $item;
|
public $item;
|
||||||
@ -37,10 +36,6 @@ class AddItemEntityPacket extends DataPacket{
|
|||||||
public $speedY;
|
public $speedY;
|
||||||
public $speedZ;
|
public $speedZ;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::ADD_ITEM_ENTITY_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class AddPaintingPacket extends DataPacket{
|
class AddPaintingPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::ADD_PAINTING_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $eid;
|
public $eid;
|
||||||
public $x;
|
public $x;
|
||||||
@ -35,10 +34,6 @@ class AddPaintingPacket extends DataPacket{
|
|||||||
public $direction;
|
public $direction;
|
||||||
public $title;
|
public $title;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::ADD_PAINTING_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,10 +29,7 @@ use pocketmine\utils\Binary;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
class AddPlayerPacket extends DataPacket{
|
class AddPlayerPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::ADD_PLAYER_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public $clientID;
|
public $clientID;
|
||||||
public $username;
|
public $username;
|
||||||
@ -52,10 +49,6 @@ class AddPlayerPacket extends DataPacket{
|
|||||||
public $slim = false;
|
public $slim = false;
|
||||||
public $skin = null;
|
public $skin = null;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::ADD_PLAYER_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,15 +25,10 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class AdventureSettingsPacket extends DataPacket{
|
class AdventureSettingsPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::ADVENTURE_SETTINGS_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $flags;
|
public $flags;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::ADVENTURE_SETTINGS_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,16 +25,11 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class AnimatePacket extends DataPacket{
|
class AnimatePacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::ANIMATE_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $action;
|
public $action;
|
||||||
public $eid;
|
public $eid;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::ANIMATE_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
$this->action = $this->getByte();
|
$this->action = $this->getByte();
|
||||||
$this->eid = $this->getLong();
|
$this->eid = $this->getLong();
|
||||||
|
@ -25,15 +25,10 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class BatchPacket extends DataPacket{
|
class BatchPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::BATCH_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $payload;
|
public $payload;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::BATCH_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
$size = $this->getInt();
|
$size = $this->getInt();
|
||||||
$this->payload = $this->get($size);
|
$this->payload = $this->get($size);
|
||||||
|
@ -25,15 +25,10 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class ContainerClosePacket extends DataPacket{
|
class ContainerClosePacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::CONTAINER_CLOSE_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $windowid;
|
public $windowid;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::CONTAINER_CLOSE_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
$this->windowid = $this->getByte();
|
$this->windowid = $this->getByte();
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class ContainerOpenPacket extends DataPacket{
|
class ContainerOpenPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::CONTAINER_OPEN_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $windowid;
|
public $windowid;
|
||||||
public $type;
|
public $type;
|
||||||
@ -35,10 +34,6 @@ class ContainerOpenPacket extends DataPacket{
|
|||||||
public $y;
|
public $y;
|
||||||
public $z;
|
public $z;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::CONTAINER_OPEN_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class ContainerSetContentPacket extends DataPacket{
|
class ContainerSetContentPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::CONTAINER_SET_CONTENT_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
const SPECIAL_INVENTORY = 0;
|
const SPECIAL_INVENTORY = 0;
|
||||||
const SPECIAL_ARMOR = 0x78;
|
const SPECIAL_ARMOR = 0x78;
|
||||||
@ -37,10 +36,6 @@ class ContainerSetContentPacket extends DataPacket{
|
|||||||
public $slots = [];
|
public $slots = [];
|
||||||
public $hotbar = [];
|
public $hotbar = [];
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::CONTAINER_SET_CONTENT_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function clean(){
|
public function clean(){
|
||||||
$this->slots = [];
|
$this->slots = [];
|
||||||
$this->hotbar = [];
|
$this->hotbar = [];
|
||||||
|
@ -25,17 +25,12 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class ContainerSetDataPacket extends DataPacket{
|
class ContainerSetDataPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::CONTAINER_SET_DATA_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $windowid;
|
public $windowid;
|
||||||
public $property;
|
public $property;
|
||||||
public $value;
|
public $value;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::CONTAINER_SET_DATA_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,18 +26,13 @@ namespace pocketmine\network\protocol;
|
|||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
|
|
||||||
class ContainerSetSlotPacket extends DataPacket{
|
class ContainerSetSlotPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::CONTAINER_SET_SLOT_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $windowid;
|
public $windowid;
|
||||||
public $slot;
|
public $slot;
|
||||||
/** @var Item */
|
/** @var Item */
|
||||||
public $item;
|
public $item;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::CONTAINER_SET_SLOT_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
$this->windowid = $this->getByte();
|
$this->windowid = $this->getByte();
|
||||||
$this->slot = $this->getShort();
|
$this->slot = $this->getShort();
|
||||||
|
@ -32,19 +32,23 @@ use pocketmine\item\Item;
|
|||||||
|
|
||||||
abstract class DataPacket extends \stdClass{
|
abstract class DataPacket extends \stdClass{
|
||||||
|
|
||||||
private $offset = 0;
|
const NETWORK_ID = 0;
|
||||||
|
|
||||||
|
public $offset = 0;
|
||||||
public $buffer = "";
|
public $buffer = "";
|
||||||
public $isEncoded = false;
|
public $isEncoded = false;
|
||||||
private $channel = 0;
|
private $channel = 0;
|
||||||
|
|
||||||
abstract public function pid();
|
public function pid(){
|
||||||
|
return $this::NETWORK_ID;
|
||||||
|
}
|
||||||
|
|
||||||
abstract public function encode();
|
abstract public function encode();
|
||||||
|
|
||||||
abstract public function decode();
|
abstract public function decode();
|
||||||
|
|
||||||
protected function reset(){
|
protected function reset(){
|
||||||
$this->buffer = chr($this->pid());
|
$this->buffer = chr($this::NETWORK_ID);
|
||||||
$this->offset = 0;
|
$this->offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,15 +25,10 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class DisconnectPacket extends DataPacket{
|
class DisconnectPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::DISCONNECT_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $message;
|
public $message;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::DISCONNECT_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
$this->message = $this->getString();
|
$this->message = $this->getString();
|
||||||
}
|
}
|
||||||
|
@ -25,17 +25,12 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class DropItemPacket extends DataPacket{
|
class DropItemPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::DROP_ITEM_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $eid;
|
public $eid;
|
||||||
public $unknown;
|
public $unknown;
|
||||||
public $item;
|
public $item;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::DROP_ITEM_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
$this->eid = $this->getLong();
|
$this->eid = $this->getLong();
|
||||||
$this->unknown = $this->getByte();
|
$this->unknown = $this->getByte();
|
||||||
|
@ -25,6 +25,7 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class EntityEventPacket extends DataPacket{
|
class EntityEventPacket extends DataPacket{
|
||||||
|
const NETWORK_ID = Info::ENTITY_EVENT_PACKET;
|
||||||
|
|
||||||
const HURT_ANIMATION = 2;
|
const HURT_ANIMATION = 2;
|
||||||
const DEATH_ANIMATION = 3;
|
const DEATH_ANIMATION = 3;
|
||||||
@ -42,16 +43,9 @@ class EntityEventPacket extends DataPacket{
|
|||||||
const AMBIENT_SOUND = 16;
|
const AMBIENT_SOUND = 16;
|
||||||
const RESPAWN = 17;
|
const RESPAWN = 17;
|
||||||
|
|
||||||
public static $pool = [];
|
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $eid;
|
public $eid;
|
||||||
public $event;
|
public $event;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::ENTITY_EVENT_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
$this->eid = $this->getLong();
|
$this->eid = $this->getLong();
|
||||||
$this->event = $this->getByte();
|
$this->event = $this->getByte();
|
||||||
|
@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class ExplodePacket extends DataPacket{
|
class ExplodePacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::EXPLODE_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $x;
|
public $x;
|
||||||
public $y;
|
public $y;
|
||||||
@ -34,10 +33,6 @@ class ExplodePacket extends DataPacket{
|
|||||||
public $radius;
|
public $radius;
|
||||||
public $records = [];
|
public $records = [];
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::EXPLODE_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function clean(){
|
public function clean(){
|
||||||
$this->records = [];
|
$this->records = [];
|
||||||
return parent::clean();
|
return parent::clean();
|
||||||
|
@ -25,17 +25,12 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class FullChunkDataPacket extends DataPacket{
|
class FullChunkDataPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::FULL_CHUNK_DATA_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $chunkX;
|
public $chunkX;
|
||||||
public $chunkZ;
|
public $chunkZ;
|
||||||
public $data;
|
public $data;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::FULL_CHUNK_DATA_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,15 +25,10 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class HurtArmorPacket extends DataPacket{
|
class HurtArmorPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::HURT_ARMOR_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $health;
|
public $health;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::HURT_ARMOR_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,17 +25,12 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class InteractPacket extends DataPacket{
|
class InteractPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::INTERACT_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $action;
|
public $action;
|
||||||
public $eid;
|
public $eid;
|
||||||
public $target;
|
public $target;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::INTERACT_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
$this->action = $this->getByte();
|
$this->action = $this->getByte();
|
||||||
$this->target = $this->getLong();
|
$this->target = $this->getLong();
|
||||||
|
@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class LevelEventPacket extends DataPacket{
|
class LevelEventPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::LEVEL_EVENT_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $evid;
|
public $evid;
|
||||||
public $x;
|
public $x;
|
||||||
@ -34,10 +33,6 @@ class LevelEventPacket extends DataPacket{
|
|||||||
public $z;
|
public $z;
|
||||||
public $data;
|
public $data;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::LEVEL_EVENT_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class LoginPacket extends DataPacket{
|
class LoginPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::LOGIN_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $username;
|
public $username;
|
||||||
public $protocol1;
|
public $protocol1;
|
||||||
@ -36,10 +35,6 @@ class LoginPacket extends DataPacket{
|
|||||||
public $slim = false;
|
public $slim = false;
|
||||||
public $skin = null;
|
public $skin = null;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::LOGIN_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
$this->username = $this->getString();
|
$this->username = $this->getString();
|
||||||
$this->protocol1 = $this->getInt();
|
$this->protocol1 = $this->getInt();
|
||||||
|
@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class MobEffectPacket extends DataPacket{
|
class MobEffectPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::MOB_EFFECT_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
const EVENT_ADD = 1;
|
const EVENT_ADD = 1;
|
||||||
const EVENT_MODIFY = 2;
|
const EVENT_MODIFY = 2;
|
||||||
@ -39,10 +38,6 @@ class MobEffectPacket extends DataPacket{
|
|||||||
public $particles = true;
|
public $particles = true;
|
||||||
public $duration;
|
public $duration;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::MOB_EFFECT_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,18 +25,13 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class MoveEntityPacket extends DataPacket{
|
class MoveEntityPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::MOVE_ENTITY_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
|
|
||||||
// eid, x, y, z, yaw, pitch
|
// eid, x, y, z, yaw, pitch
|
||||||
/** @var array[] */
|
/** @var array[] */
|
||||||
public $entities = [];
|
public $entities = [];
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::MOVE_ENTITY_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function clean(){
|
public function clean(){
|
||||||
$this->entities = [];
|
$this->entities = [];
|
||||||
return parent::clean();
|
return parent::clean();
|
||||||
|
@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class MovePlayerPacket extends DataPacket{
|
class MovePlayerPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::MOVE_PLAYER_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $eid;
|
public $eid;
|
||||||
public $x;
|
public $x;
|
||||||
@ -38,10 +37,6 @@ class MovePlayerPacket extends DataPacket{
|
|||||||
public $mode = 0;
|
public $mode = 0;
|
||||||
public $onGround;
|
public $onGround;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::MOVE_PLAYER_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function clean(){
|
public function clean(){
|
||||||
$this->teleport = false;
|
$this->teleport = false;
|
||||||
return parent::clean();
|
return parent::clean();
|
||||||
|
@ -25,21 +25,15 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class PlayStatusPacket extends DataPacket{
|
class PlayStatusPacket extends DataPacket{
|
||||||
|
const NETWORK_ID = Info::PLAY_STATUS_PACKET;
|
||||||
|
|
||||||
const LOGIN_SUCCESS = 0;
|
const LOGIN_SUCCESS = 0;
|
||||||
const LOGIN_FAILED_CLIENT = 1;
|
const LOGIN_FAILED_CLIENT = 1;
|
||||||
const LOGIN_FAILED_SERVER = 2;
|
const LOGIN_FAILED_SERVER = 2;
|
||||||
const PLAYER_SPAWN = 3;
|
const PLAYER_SPAWN = 3;
|
||||||
|
|
||||||
public static $pool = [];
|
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $status;
|
public $status;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::PLAY_STATUS_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class PlayerActionPacket extends DataPacket{
|
class PlayerActionPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::PLAYER_ACTION_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $eid;
|
public $eid;
|
||||||
public $action;
|
public $action;
|
||||||
@ -35,10 +34,6 @@ class PlayerActionPacket extends DataPacket{
|
|||||||
public $z;
|
public $z;
|
||||||
public $face;
|
public $face;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::PLAYER_ACTION_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
$this->eid = $this->getLong();
|
$this->eid = $this->getLong();
|
||||||
$this->action = $this->getInt();
|
$this->action = $this->getInt();
|
||||||
|
@ -25,16 +25,11 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class PlayerArmorEquipmentPacket extends DataPacket{
|
class PlayerArmorEquipmentPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::PLAYER_ARMOR_EQUIPMENT_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $eid;
|
public $eid;
|
||||||
public $slots = [];
|
public $slots = [];
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::PLAYER_ARMOR_EQUIPMENT_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
$this->eid = $this->getLong();
|
$this->eid = $this->getLong();
|
||||||
$this->slots[0] = $this->getByte();
|
$this->slots[0] = $this->getByte();
|
||||||
|
@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class PlayerEquipmentPacket extends DataPacket{
|
class PlayerEquipmentPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::PLAYER_EQUIPMENT_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $eid;
|
public $eid;
|
||||||
public $item;
|
public $item;
|
||||||
@ -34,10 +33,6 @@ class PlayerEquipmentPacket extends DataPacket{
|
|||||||
public $slot;
|
public $slot;
|
||||||
public $selectedSlot;
|
public $selectedSlot;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::PLAYER_EQUIPMENT_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
$this->eid = $this->getLong();
|
$this->eid = $this->getLong();
|
||||||
$this->item = $this->getShort();
|
$this->item = $this->getShort();
|
||||||
|
@ -25,18 +25,13 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class RemoveBlockPacket extends DataPacket{
|
class RemoveBlockPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::REMOVE_BLOCK_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $eid;
|
public $eid;
|
||||||
public $x;
|
public $x;
|
||||||
public $y;
|
public $y;
|
||||||
public $z;
|
public $z;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::REMOVE_BLOCK_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
$this->eid = $this->getLong();
|
$this->eid = $this->getLong();
|
||||||
$this->x = $this->getInt();
|
$this->x = $this->getInt();
|
||||||
|
@ -25,15 +25,10 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class RemoveEntityPacket extends DataPacket{
|
class RemoveEntityPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::REMOVE_ENTITY_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $eid;
|
public $eid;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::REMOVE_ENTITY_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,16 +25,11 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class RemovePlayerPacket extends DataPacket{
|
class RemovePlayerPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::REMOVE_PLAYER_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $eid;
|
public $eid;
|
||||||
public $clientID;
|
public $clientID;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::REMOVE_PLAYER_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,17 +25,12 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class RespawnPacket extends DataPacket{
|
class RespawnPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::RESPAWN_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $x;
|
public $x;
|
||||||
public $y;
|
public $y;
|
||||||
public $z;
|
public $z;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::RESPAWN_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
$this->x = $this->getFloat();
|
$this->x = $this->getFloat();
|
||||||
$this->y = $this->getFloat();
|
$this->y = $this->getFloat();
|
||||||
|
@ -25,15 +25,10 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class SetDifficultyPacket extends DataPacket{
|
class SetDifficultyPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::SET_DIFFICULTY_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $difficulty;
|
public $difficulty;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::SET_DIFFICULTY_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
$this->difficulty = $this->getInt();
|
$this->difficulty = $this->getInt();
|
||||||
}
|
}
|
||||||
|
@ -29,16 +29,11 @@ use pocketmine\utils\Binary;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
class SetEntityDataPacket extends DataPacket{
|
class SetEntityDataPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::SET_ENTITY_DATA_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $eid;
|
public $eid;
|
||||||
public $metadata;
|
public $metadata;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::SET_ENTITY_DATA_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,17 +25,12 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class SetEntityLinkPacket extends DataPacket{
|
class SetEntityLinkPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::SET_ENTITY_LINK_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $from;
|
public $from;
|
||||||
public $to;
|
public $to;
|
||||||
public $type;
|
public $type;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::SET_ENTITY_LINK_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,18 +25,13 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class SetEntityMotionPacket extends DataPacket{
|
class SetEntityMotionPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::SET_ENTITY_MOTION_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
|
|
||||||
// eid, motX, motY, motZ
|
// eid, motX, motY, motZ
|
||||||
/** @var array[] */
|
/** @var array[] */
|
||||||
public $entities = [];
|
public $entities = [];
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::SET_ENTITY_MOTION_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function clean(){
|
public function clean(){
|
||||||
$this->entities = [];
|
$this->entities = [];
|
||||||
return parent::clean();
|
return parent::clean();
|
||||||
|
@ -25,15 +25,10 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class SetHealthPacket extends DataPacket{
|
class SetHealthPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::SET_HEALTH_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $health;
|
public $health;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::SET_HEALTH_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
$this->health = $this->getInt();
|
$this->health = $this->getInt();
|
||||||
}
|
}
|
||||||
|
@ -25,17 +25,12 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class SetSpawnPositionPacket extends DataPacket{
|
class SetSpawnPositionPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::SET_SPAWN_POSITION_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $x;
|
public $x;
|
||||||
public $z;
|
public $z;
|
||||||
public $y;
|
public $y;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::SET_SPAWN_POSITION_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,16 +27,11 @@ namespace pocketmine\network\protocol;
|
|||||||
use pocketmine\level\Level;
|
use pocketmine\level\Level;
|
||||||
|
|
||||||
class SetTimePacket extends DataPacket{
|
class SetTimePacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::SET_TIME_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $time;
|
public $time;
|
||||||
public $started = true;
|
public $started = true;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::SET_TIME_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class StartGamePacket extends DataPacket{
|
class StartGamePacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::START_GAME_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $seed;
|
public $seed;
|
||||||
public $generator;
|
public $generator;
|
||||||
@ -39,10 +38,6 @@ class StartGamePacket extends DataPacket{
|
|||||||
public $y;
|
public $y;
|
||||||
public $z;
|
public $z;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::START_GAME_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,16 +25,11 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class TakeItemEntityPacket extends DataPacket{
|
class TakeItemEntityPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::TAKE_ITEM_ENTITY_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $target;
|
public $target;
|
||||||
public $eid;
|
public $eid;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::TAKE_ITEM_ENTITY_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class TextPacket extends DataPacket{
|
class TextPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::TEXT_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
const TYPE_RAW = 0;
|
const TYPE_RAW = 0;
|
||||||
const TYPE_CHAT = 1;
|
const TYPE_CHAT = 1;
|
||||||
@ -39,10 +38,6 @@ class TextPacket extends DataPacket{
|
|||||||
public $message;
|
public $message;
|
||||||
public $parameters = [];
|
public $parameters = [];
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::TEXT_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
$this->type = $this->getByte();
|
$this->type = $this->getByte();
|
||||||
switch($this->type){
|
switch($this->type){
|
||||||
|
@ -25,18 +25,13 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class TileEntityDataPacket extends DataPacket{
|
class TileEntityDataPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::TILE_ENTITY_DATA_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $x;
|
public $x;
|
||||||
public $y;
|
public $y;
|
||||||
public $z;
|
public $z;
|
||||||
public $namedtag;
|
public $namedtag;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::TILE_ENTITY_DATA_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
$this->x = $this->getInt();
|
$this->x = $this->getInt();
|
||||||
$this->y = $this->getByte();
|
$this->y = $this->getByte();
|
||||||
|
@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class TileEventPacket extends DataPacket{
|
class TileEventPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::TILE_EVENT_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $x;
|
public $x;
|
||||||
public $y;
|
public $y;
|
||||||
@ -34,10 +33,6 @@ class TileEventPacket extends DataPacket{
|
|||||||
public $case1;
|
public $case1;
|
||||||
public $case2;
|
public $case2;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::TILE_EVENT_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
<?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 UnknownPacket extends DataPacket{
|
|
||||||
public static $pool = [];
|
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $packetID = -1;
|
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return $this->packetID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function encode(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class UpdateBlockPacket extends DataPacket{
|
class UpdateBlockPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::UPDATE_BLOCK_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
const FLAG_NONE = 0b0000;
|
const FLAG_NONE = 0b0000;
|
||||||
const FLAG_NEIGHBORS = 0b0001;
|
const FLAG_NEIGHBORS = 0b0001;
|
||||||
@ -39,10 +38,6 @@ class UpdateBlockPacket extends DataPacket{
|
|||||||
|
|
||||||
public $records = []; //x, z, y, blockId, blockData, flags
|
public $records = []; //x, z, y, blockId, blockData, flags
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::UPDATE_BLOCK_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
|
|||||||
|
|
||||||
|
|
||||||
class UseItemPacket extends DataPacket{
|
class UseItemPacket extends DataPacket{
|
||||||
public static $pool = [];
|
const NETWORK_ID = Info::USE_ITEM_PACKET;
|
||||||
public static $next = 0;
|
|
||||||
|
|
||||||
public $x;
|
public $x;
|
||||||
public $y;
|
public $y;
|
||||||
@ -42,10 +41,6 @@ class UseItemPacket extends DataPacket{
|
|||||||
public $posY;
|
public $posY;
|
||||||
public $posZ;
|
public $posZ;
|
||||||
|
|
||||||
public function pid(){
|
|
||||||
return Info::USE_ITEM_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
$this->x = $this->getInt();
|
$this->x = $this->getInt();
|
||||||
$this->y = $this->getInt();
|
$this->y = $this->getInt();
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 675c7b0c98645c1c63505bcb94e8556412124e67
|
Subproject commit 88c47ff3eca89dd369c9a4d575d40a777bda4ac8
|
2
src/spl
2
src/spl
@ -1 +1 @@
|
|||||||
Subproject commit 0bea1c5d4003a3d0a8a38a9c2192bf9dcfc26f46
|
Subproject commit d59c0f673455f02b2620853f3fa6290d63ffd960
|
Loading…
x
Reference in New Issue
Block a user