PocketMine-MP
5.23.3 git-f7687af337d001ddbcc47b8e773f014a33faa662
Loading...
Searching...
No Matches
LevelEventPacket.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\LevelEvent
;
20
21
class
LevelEventPacket
extends
DataPacket
implements
ClientboundPacket
{
22
public
const
NETWORK_ID = ProtocolInfo::LEVEL_EVENT_PACKET;
23
25
public
int
$eventId
;
26
public
int
$eventData;
27
public
?
Vector3
$position =
null
;
28
32
public
static
function
create
(
int
$eventId
,
int
$eventData, ?
Vector3
$position) : self{
33
$result = new self;
34
$result->eventId =
$eventId
;
35
$result->eventData = $eventData;
36
$result->position = $position;
37
return
$result;
38
}
39
40
public
static
function
standardParticle(
int
$particleId,
int
$data,
Vector3
$position) : self{
41
return self::create(
LevelEvent
::ADD_PARTICLE_MASK | $particleId, $data, $position);
42
}
43
44
protected
function
decodePayload
(
PacketSerializer
$in) : void{
45
$this->eventId = $in->getVarInt();
46
$this->position = $in->
getVector3
();
47
$this->eventData = $in->
getVarInt
();
48
}
49
50
protected
function
encodePayload
(
PacketSerializer
$out) : void{
51
$out->putVarInt($this->eventId);
52
$out->
putVector3Nullable
($this->position);
53
$out->
putVarInt
($this->eventData);
54
}
55
56
public
function
handle
(
PacketHandlerInterface
$handler) : bool{
57
return $handler->handleLevelEvent($this);
58
}
59
}
pocketmine\math\Vector3
Definition
Vector3.php:36
pocketmine\network\mcpe\protocol\DataPacket
Definition
DataPacket.php:21
pocketmine\network\mcpe\protocol\LevelEventPacket
Definition
LevelEventPacket.php:21
pocketmine\network\mcpe\protocol\LevelEventPacket\$eventId
int $eventId
Definition
LevelEventPacket.php:25
pocketmine\network\mcpe\protocol\LevelEventPacket\create
static create(int $eventId, int $eventData, ?Vector3 $position)
Definition
LevelEventPacket.php:32
pocketmine\network\mcpe\protocol\LevelEventPacket\decodePayload
decodePayload(PacketSerializer $in)
Definition
LevelEventPacket.php:44
pocketmine\network\mcpe\protocol\LevelEventPacket\handle
handle(PacketHandlerInterface $handler)
Definition
LevelEventPacket.php:56
pocketmine\network\mcpe\protocol\LevelEventPacket\encodePayload
encodePayload(PacketSerializer $out)
Definition
LevelEventPacket.php:50
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\putVector3Nullable
putVector3Nullable(?Vector3 $vector)
Definition
bedrock-protocol/src/serializer/PacketSerializer.php:504
pocketmine\network\mcpe\protocol\types\LevelEvent
Definition
LevelEvent.php:17
pocketmine\utils\BinaryStream\putVarInt
putVarInt(int $v)
Definition
BinaryStream.php:331
pocketmine\utils\BinaryStream\getVarInt
getVarInt()
Definition
BinaryStream.php:324
pocketmine\network\mcpe\protocol\ClientboundPacket
Definition
ClientboundPacket.php:17
pocketmine\network\mcpe\protocol\PacketHandlerInterface
Definition
PacketHandlerInterface.php:20
vendor
pocketmine
bedrock-protocol
src
LevelEventPacket.php
Generated by
1.12.0