Skins, protocol changes, handle split packets

This commit is contained in:
Shoghi Cervantes
2015-04-08 13:00:15 +02:00
parent c9adc336ee
commit 141c0a297e
26 changed files with 292 additions and 507 deletions

View File

@ -22,15 +22,9 @@
namespace pocketmine\level\particle;
use pocketmine\entity\Entity;
use pocketmine\entity\Wolf;
use pocketmine\math\Vector3;
use pocketmine\network\protocol\AddEntityPacket;
use pocketmine\network\protocol\AddMobPacket;
use pocketmine\network\protocol\AddPlayerPacket;
use pocketmine\network\protocol\EntityEventPacket;
use pocketmine\network\protocol\RemoveEntityPacket;
use pocketmine\network\protocol\RemovePlayerPacket;
use pocketmine\network\protocol\SetEntityDataPacket;
class FloatingTextParticle extends Particle{
//TODO: HACK!
@ -98,6 +92,6 @@ class FloatingTextParticle extends Particle{
$p[] = $pk;
}
return $pk;
return $p;
}
}

View File

@ -1,73 +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\level\particle;
use pocketmine\entity\Entity;
use pocketmine\entity\Wolf;
use pocketmine\math\Vector3;
use pocketmine\network\protocol\AddMobPacket;
use pocketmine\network\protocol\EntityEventPacket;
use pocketmine\network\protocol\RemoveEntityPacket;
class InkCloudParticle extends Particle{
//TODO: HACK!
protected $count = 1;
public function __construct(Vector3 $pos, $count = 1){
parent::__construct($pos);
$this->count = (int) $count;
}
public function encode(){
$p = [];
$entityId = bcadd("1095216660480", mt_rand(0, 0x7fffffff)); //No conflict with other things
$pk = new AddMobPacket();
$pk->eid = $entityId;
$pk->type = 17;
$pk->x = $this->x;
$pk->y = $this->y - 1;
$pk->z = $this->z;
$pk->pitch = 0;
$pk->yaw = 0;
$pk->metadata = [
Entity::DATA_FLAGS => [Entity::DATA_TYPE_BYTE, 1 << Entity::DATA_FLAG_INVISIBLE],
Entity::DATA_AIR => [Entity::DATA_TYPE_SHORT, 300]
];
$p[] = $pk;
for($i = 0; $i < $this->count; ++$i){
$pk2 = new EntityEventPacket();
$pk2->eid = $entityId;
$pk2->event = 15;
$p[] = $pk2;
}
$pk3 = new RemoveEntityPacket();
$pk3->eid = $entityId;
$p[] = $pk3;
return $p;
}
}

View File

@ -1,73 +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\level\particle;
use pocketmine\entity\Entity;
use pocketmine\entity\Wolf;
use pocketmine\math\Vector3;
use pocketmine\network\protocol\AddMobPacket;
use pocketmine\network\protocol\EntityEventPacket;
use pocketmine\network\protocol\RemoveEntityPacket;
class MateFailParticle extends Particle{
//TODO: HACK!
protected $count = 1;
public function __construct(Vector3 $pos, $count = 1){
parent::__construct($pos->x, $pos->y, $pos->z);
$this->count = (int) $count;
}
public function encode(){
$p = [];
$entityId = bcadd("1095216660480", mt_rand(0, 0x7fffffff)); //No conflict with other things
$pk = new AddMobPacket();
$pk->eid = $entityId;
$pk->type = Wolf::NETWORK_ID;
$pk->x = $this->x;
$pk->y = $this->y - 1;
$pk->z = $this->z;
$pk->pitch = 0;
$pk->yaw = 0;
$pk->metadata = [
Entity::DATA_FLAGS => [Entity::DATA_TYPE_BYTE, 1 << Entity::DATA_FLAG_INVISIBLE],
Entity::DATA_AIR => [Entity::DATA_TYPE_SHORT, 300]
];
$p[] = $pk;
for($i = 0; $i < $this->count; ++$i){
$pk2 = new EntityEventPacket();
$pk2->eid = $entityId;
$pk2->event = 6;
$p[] = $pk2;
}
$pk3 = new RemoveEntityPacket();
$pk3->eid = $entityId;
$p[] = $pk3;
return $p;
}
}

View File

@ -1,73 +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\level\particle;
use pocketmine\entity\Entity;
use pocketmine\entity\Wolf;
use pocketmine\math\Vector3;
use pocketmine\network\protocol\AddMobPacket;
use pocketmine\network\protocol\EntityEventPacket;
use pocketmine\network\protocol\RemoveEntityPacket;
class MateParticle extends Particle{
//TODO: HACK!
protected $count = 1;
public function __construct(Vector3 $pos, $count = 1){
parent::__construct($pos->x, $pos->y, $pos->z);
$this->count = (int) $count;
}
public function encode(){
$p = [];
$entityId = bcadd("1095216660480", mt_rand(0, 0x7fffffff)); //No conflict with other things
$pk = new AddMobPacket();
$pk->eid = $entityId;
$pk->type = Wolf::NETWORK_ID;
$pk->x = $this->x;
$pk->y = $this->y - 1;
$pk->z = $this->z;
$pk->pitch = 0;
$pk->yaw = 0;
$pk->metadata = [
Entity::DATA_FLAGS => [Entity::DATA_TYPE_BYTE, 1 << Entity::DATA_FLAG_INVISIBLE],
Entity::DATA_AIR => [Entity::DATA_TYPE_SHORT, 300]
];
$p[] = $pk;
for($i = 0; $i < $this->count; ++$i){
$pk2 = new EntityEventPacket();
$pk2->eid = $entityId;
$pk2->event = 7;
$p[] = $pk2;
}
$pk3 = new RemoveEntityPacket();
$pk3->eid = $entityId;
$p[] = $pk3;
return $p;
}
}