PocketMine-MP
5.23.3 git-f7687af337d001ddbcc47b8e773f014a33faa662
Loading...
Searching...
No Matches
CompletedUsingItemPacket.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\network\mcpe\protocol\serializer\PacketSerializer
;
18
19
class
CompletedUsingItemPacket
extends
DataPacket
implements
ClientboundPacket
{
20
public
const
NETWORK_ID = ProtocolInfo::COMPLETED_USING_ITEM_PACKET;
21
22
public
const
ACTION_UNKNOWN = -1;
23
public
const
ACTION_EQUIP_ARMOR = 0;
24
public
const
ACTION_EAT = 1;
25
public
const
ACTION_ATTACK = 2;
26
public
const
ACTION_CONSUME = 3;
27
public
const
ACTION_THROW = 4;
28
public
const
ACTION_SHOOT = 5;
29
public
const
ACTION_PLACE = 6;
30
public
const
ACTION_FILL_BOTTLE = 7;
31
public
const
ACTION_FILL_BUCKET = 8;
32
public
const
ACTION_POUR_BUCKET = 9;
33
public
const
ACTION_USE_TOOL = 10;
34
public
const
ACTION_INTERACT = 11;
35
public
const
ACTION_RETRIEVED = 12;
36
public
const
ACTION_DYED = 13;
37
public
const
ACTION_TRADED = 14;
38
public
const
ACTION_BRUSHING_COMPLETED = 15;
39
40
public
int
$itemId;
41
public
int
$action;
42
46
public
static
function
create
(
int
$itemId,
int
$action) : self{
47
$result = new self;
48
$result->itemId = $itemId;
49
$result->action = $action;
50
return
$result;
51
}
52
53
public
function
decodePayload
(
PacketSerializer
$in) : void{
54
$this->itemId = $in->getShort();
55
$this->action = $in->
getLInt
();
56
}
57
58
public
function
encodePayload
(
PacketSerializer
$out) : void{
59
$out->putShort($this->itemId);
60
$out->putLInt($this->action);
61
}
62
63
public
function
handle
(
PacketHandlerInterface
$handler) : bool{
64
return $handler->handleCompletedUsingItem($this);
65
}
66
}
pocketmine\network\mcpe\protocol\CompletedUsingItemPacket
Definition
CompletedUsingItemPacket.php:19
pocketmine\network\mcpe\protocol\CompletedUsingItemPacket\decodePayload
decodePayload(PacketSerializer $in)
Definition
CompletedUsingItemPacket.php:53
pocketmine\network\mcpe\protocol\CompletedUsingItemPacket\handle
handle(PacketHandlerInterface $handler)
Definition
CompletedUsingItemPacket.php:63
pocketmine\network\mcpe\protocol\CompletedUsingItemPacket\encodePayload
encodePayload(PacketSerializer $out)
Definition
CompletedUsingItemPacket.php:58
pocketmine\network\mcpe\protocol\CompletedUsingItemPacket\create
static create(int $itemId, int $action)
Definition
CompletedUsingItemPacket.php:46
pocketmine\network\mcpe\protocol\DataPacket
Definition
DataPacket.php:21
pocketmine\network\mcpe\protocol\serializer\PacketSerializer
Definition
bedrock-protocol/src/serializer/PacketSerializer.php:66
pocketmine\utils\BinaryStream\getLInt
getLInt()
Definition
BinaryStream.php:205
pocketmine\network\mcpe\protocol\ClientboundPacket
Definition
ClientboundPacket.php:17
pocketmine\network\mcpe\protocol\PacketHandlerInterface
Definition
PacketHandlerInterface.php:20
vendor
pocketmine
bedrock-protocol
src
CompletedUsingItemPacket.php
Generated by
1.12.0