PocketMine-MP
5.23.3 git-f7687af337d001ddbcc47b8e773f014a33faa662
Loading...
Searching...
No Matches
SpawnParticleEffectPacket.php
1
<?php
2
3
/*
4
* This file is part of BedrockProtocol.
5
* Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol>
6
*
7
* BedrockProtocol is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU Lesser General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
*/
12
13
declare(strict_types=1);
14
15
namespace
pocketmine\network\mcpe\protocol;
16
17
use
pocketmine\math\Vector3
;
18
use
pocketmine\network\mcpe\protocol\serializer\PacketSerializer
;
19
use
pocketmine\network\mcpe\protocol\types\DimensionIds
;
20
21
class
SpawnParticleEffectPacket
extends
DataPacket
implements
ClientboundPacket
{
22
public
const
NETWORK_ID = ProtocolInfo::SPAWN_PARTICLE_EFFECT_PACKET;
23
24
public
int
$dimensionId = DimensionIds::OVERWORLD;
//wtf mojang
25
public
int
$actorUniqueId = -1;
//default none
26
public
Vector3
$position;
27
public
string
$particleName;
28
public
?
string
$molangVariablesJson =
null
;
29
33
public
static
function
create
(
int
$dimensionId,
int
$actorUniqueId,
Vector3
$position,
string
$particleName, ?
string
$molangVariablesJson) : self{
34
$result = new self;
35
$result->dimensionId = $dimensionId;
36
$result->actorUniqueId = $actorUniqueId;
37
$result->position = $position;
38
$result->particleName = $particleName;
39
$result->molangVariablesJson = $molangVariablesJson;
40
return
$result;
41
}
42
43
protected
function
decodePayload
(
PacketSerializer
$in) : void{
44
$this->dimensionId = $in->getByte();
45
$this->actorUniqueId = $in->
getActorUniqueId
();
46
$this->position = $in->
getVector3
();
47
$this->particleName = $in->
getString
();
48
$this->molangVariablesJson = $in->
getBool
() ? $in->
getString
() :
null
;
49
}
50
51
protected
function
encodePayload
(
PacketSerializer
$out) : void{
52
$out->putByte($this->dimensionId);
53
$out->putActorUniqueId($this->actorUniqueId);
54
$out->
putVector3
($this->position);
55
$out->putString($this->particleName);
56
$out->putBool($this->molangVariablesJson !==
null
);
57
if
($this->molangVariablesJson !==
null
){
58
$out->putString($this->molangVariablesJson);
59
}
60
}
61
62
public
function
handle
(
PacketHandlerInterface
$handler) : bool{
63
return $handler->handleSpawnParticleEffect($this);
64
}
65
}
pocketmine\math\Vector3
Definition
Vector3.php:36
pocketmine\network\mcpe\protocol\DataPacket
Definition
DataPacket.php:21
pocketmine\network\mcpe\protocol\SpawnParticleEffectPacket
Definition
SpawnParticleEffectPacket.php:21
pocketmine\network\mcpe\protocol\SpawnParticleEffectPacket\handle
handle(PacketHandlerInterface $handler)
Definition
SpawnParticleEffectPacket.php:62
pocketmine\network\mcpe\protocol\SpawnParticleEffectPacket\encodePayload
encodePayload(PacketSerializer $out)
Definition
SpawnParticleEffectPacket.php:51
pocketmine\network\mcpe\protocol\SpawnParticleEffectPacket\create
static create(int $dimensionId, int $actorUniqueId, Vector3 $position, string $particleName, ?string $molangVariablesJson)
Definition
SpawnParticleEffectPacket.php:33
pocketmine\network\mcpe\protocol\SpawnParticleEffectPacket\decodePayload
decodePayload(PacketSerializer $in)
Definition
SpawnParticleEffectPacket.php:43
pocketmine\network\mcpe\protocol\serializer\PacketSerializer
Definition
bedrock-protocol/src/serializer/PacketSerializer.php:66
pocketmine\network\mcpe\protocol\serializer\PacketSerializer\getVector3
getVector3()
Definition
bedrock-protocol/src/serializer/PacketSerializer.php:478
pocketmine\network\mcpe\protocol\serializer\PacketSerializer\putVector3
putVector3(Vector3 $vector)
Definition
bedrock-protocol/src/serializer/PacketSerializer.php:517
pocketmine\network\mcpe\protocol\serializer\PacketSerializer\getActorUniqueId
getActorUniqueId()
Definition
bedrock-protocol/src/serializer/PacketSerializer.php:412
pocketmine\network\mcpe\protocol\serializer\PacketSerializer\getString
getString()
Definition
bedrock-protocol/src/serializer/PacketSerializer.php:83
pocketmine\network\mcpe\protocol\types\DimensionIds
Definition
DimensionIds.php:17
pocketmine\utils\BinaryStream\getBool
getBool()
Definition
BinaryStream.php:105
pocketmine\network\mcpe\protocol\ClientboundPacket
Definition
ClientboundPacket.php:17
pocketmine\network\mcpe\protocol\PacketHandlerInterface
Definition
PacketHandlerInterface.php:20
vendor
pocketmine
bedrock-protocol
src
SpawnParticleEffectPacket.php
Generated by
1.12.0