mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 09:19:42 +00:00
Particles.
This commit is contained in:
parent
b31604a536
commit
c2a3298a7e
@ -1288,7 +1288,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
}
|
||||
$drops = $target->getDrops($item); //Fixes tile entities being deleted before getting drops
|
||||
|
||||
$this->addParticle(new DestroyBlockParticle($target, $target));
|
||||
$this->addParticle(new DestroyBlockParticle($target->add(0.5, 0.5, 0.5), $target));
|
||||
|
||||
$target->onBreak($item);
|
||||
|
||||
|
30
src/pocketmine/level/particle/BubbleParticle.php
Normal file
30
src/pocketmine/level/particle/BubbleParticle.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?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\math\Vector3;
|
||||
|
||||
class BubbleParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z, 1);
|
||||
}
|
||||
}
|
30
src/pocketmine/level/particle/CriticalParticle.php
Normal file
30
src/pocketmine/level/particle/CriticalParticle.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?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\math\Vector3;
|
||||
|
||||
class CriticalParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z, 2);
|
||||
}
|
||||
}
|
30
src/pocketmine/level/particle/DustParticle.php
Normal file
30
src/pocketmine/level/particle/DustParticle.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?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\math\Vector3;
|
||||
|
||||
class DustParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos, $r, $g, $b, $a = 255){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z, 22, (($a & 0xff) << 24) | (($r & 0xff) << 16) | (($g & 0xff) << 8) | ($b & 0xff));
|
||||
}
|
||||
}
|
30
src/pocketmine/level/particle/EnchantParticle.php
Normal file
30
src/pocketmine/level/particle/EnchantParticle.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?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\math\Vector3;
|
||||
|
||||
class EnchantParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z, 23);
|
||||
}
|
||||
}
|
30
src/pocketmine/level/particle/EntityFlameParticle.php
Normal file
30
src/pocketmine/level/particle/EntityFlameParticle.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?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\math\Vector3;
|
||||
|
||||
class EntityFlameParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z, 13);
|
||||
}
|
||||
}
|
@ -21,22 +21,10 @@
|
||||
|
||||
namespace pocketmine\level\particle;
|
||||
|
||||
use pocketmine\network\protocol\ExplodePacket;
|
||||
use pocketmine\math\Vector3;
|
||||
|
||||
class ExplodeParticle extends Particle{
|
||||
|
||||
class ExplodeParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z);
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
$pk = new ExplodePacket;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->radius = 0;
|
||||
|
||||
return $pk;
|
||||
parent::__construct($pos->x, $pos->y, $pos->z, 4);
|
||||
}
|
||||
}
|
||||
|
30
src/pocketmine/level/particle/FlameParticle.php
Normal file
30
src/pocketmine/level/particle/FlameParticle.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?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\math\Vector3;
|
||||
|
||||
class FlameParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z, 5);
|
||||
}
|
||||
}
|
48
src/pocketmine/level/particle/GenericParticle.php
Normal file
48
src/pocketmine/level/particle/GenericParticle.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?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\network\protocol\LevelEventPacket;
|
||||
use pocketmine\math\Vector3;
|
||||
|
||||
class GenericParticle extends Particle{
|
||||
|
||||
protected $id;
|
||||
protected $data;
|
||||
|
||||
public function __construct(Vector3 $pos, $id, $data = 0){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z);
|
||||
$this->id = $id & 0xFFF;
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
$pk = new LevelEventPacket;
|
||||
$pk->evid = 0x4000 | $this->id;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->data = $this->data;
|
||||
|
||||
return $pk;
|
||||
}
|
||||
}
|
@ -21,43 +21,10 @@
|
||||
|
||||
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 HeartParticle extends Particle{
|
||||
//TODO: HACK!
|
||||
//TODO: needs more testing!
|
||||
|
||||
public function __construct(Vector3 $pos){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z);
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
$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]
|
||||
];
|
||||
|
||||
$pk2 = new EntityEventPacket();
|
||||
$pk2->eid = $entityId;
|
||||
$pk2->event = 7;
|
||||
|
||||
$pk3 = new RemoveEntityPacket();
|
||||
$pk3->eid = $entityId;
|
||||
|
||||
return [$pk, $pk2, $pk3];
|
||||
class HeartParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos, $scale = 0){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z, 14, $scale);
|
||||
}
|
||||
}
|
||||
|
73
src/pocketmine/level/particle/InkCloudParticle.php
Normal file
73
src/pocketmine/level/particle/InkCloudParticle.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?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->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 = 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;
|
||||
}
|
||||
}
|
30
src/pocketmine/level/particle/InkParticle.php
Normal file
30
src/pocketmine/level/particle/InkParticle.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?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\math\Vector3;
|
||||
|
||||
class InkParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos, $scale = 0){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z, 25, $scale);
|
||||
}
|
||||
}
|
31
src/pocketmine/level/particle/ItemBreakParticle.php
Normal file
31
src/pocketmine/level/particle/ItemBreakParticle.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?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\math\Vector3;
|
||||
use pocketmine\item\Item;
|
||||
|
||||
class ItemBreakParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos, Item $item){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z, 9, ($item->getId() << 16) | $item->getDamage());
|
||||
}
|
||||
}
|
30
src/pocketmine/level/particle/LavaDripParticle.php
Normal file
30
src/pocketmine/level/particle/LavaDripParticle.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?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\math\Vector3;
|
||||
|
||||
class LavaDripParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z, 21);
|
||||
}
|
||||
}
|
30
src/pocketmine/level/particle/LavaParticle.php
Normal file
30
src/pocketmine/level/particle/LavaParticle.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?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\math\Vector3;
|
||||
|
||||
class LavaParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z, 6);
|
||||
}
|
||||
}
|
73
src/pocketmine/level/particle/MateFailParticle.php
Normal file
73
src/pocketmine/level/particle/MateFailParticle.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
73
src/pocketmine/level/particle/MateParticle.php
Normal file
73
src/pocketmine/level/particle/MateParticle.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
30
src/pocketmine/level/particle/PortalParticle.php
Normal file
30
src/pocketmine/level/particle/PortalParticle.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?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\math\Vector3;
|
||||
|
||||
class PortalParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z, 17);
|
||||
}
|
||||
}
|
30
src/pocketmine/level/particle/RedstoneParticle.php
Normal file
30
src/pocketmine/level/particle/RedstoneParticle.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?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\math\Vector3;
|
||||
|
||||
class RedstoneParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos, $lifetime = 1){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z, 8, $lifetime);
|
||||
}
|
||||
}
|
30
src/pocketmine/level/particle/SmokeParticle.php
Normal file
30
src/pocketmine/level/particle/SmokeParticle.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?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\math\Vector3;
|
||||
|
||||
class SmokeParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos, $scale = 0){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z, 3, (int) $scale);
|
||||
}
|
||||
}
|
30
src/pocketmine/level/particle/SplashParticle.php
Normal file
30
src/pocketmine/level/particle/SplashParticle.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?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\math\Vector3;
|
||||
|
||||
class SplashParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z, 18);
|
||||
}
|
||||
}
|
31
src/pocketmine/level/particle/TerrainParticle.php
Normal file
31
src/pocketmine/level/particle/TerrainParticle.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?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\block\Block;
|
||||
use pocketmine\math\Vector3;
|
||||
|
||||
class TerrainParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos, Block $b){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z, 15, ($b->getId() << 8) | $b->getDamage());
|
||||
}
|
||||
}
|
30
src/pocketmine/level/particle/WaterDripParticle.php
Normal file
30
src/pocketmine/level/particle/WaterDripParticle.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?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\math\Vector3;
|
||||
|
||||
class WaterDripParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z, 20);
|
||||
}
|
||||
}
|
30
src/pocketmine/level/particle/WaterParticle.php
Normal file
30
src/pocketmine/level/particle/WaterParticle.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?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\math\Vector3;
|
||||
|
||||
class WaterParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z, 19);
|
||||
}
|
||||
}
|
@ -45,9 +45,9 @@ class LevelEventPacket extends DataPacket{
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putShort($this->evid);
|
||||
$this->putInt($this->x);
|
||||
$this->putByte($this->y);
|
||||
$this->putInt($this->z);
|
||||
$this->putFloat($this->x);
|
||||
$this->putFloat($this->y);
|
||||
$this->putFloat($this->z);
|
||||
$this->putInt($this->data);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user