PocketMine-MP
5.21.2 git-a6534ecbbbcf369264567d27e5ed70f7f5be9816
Loading...
Searching...
No Matches
PlayerToggleCrafterSlotRequestPacket.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
use
pocketmine\network\mcpe\protocol\types\BlockPosition
;
19
20
class
PlayerToggleCrafterSlotRequestPacket
extends
DataPacket
implements
ServerboundPacket
{
21
public
const
NETWORK_ID = ProtocolInfo::PLAYER_TOGGLE_CRAFTER_SLOT_REQUEST_PACKET;
22
23
private
BlockPosition
$position;
24
private
int
$slot;
25
private
bool
$disabled;
26
30
public
static
function
create
(
BlockPosition
$position,
int
$slot,
bool
$disabled) : self{
31
$result = new self;
32
$result->position = $position;
33
$result->slot = $slot;
34
$result->disabled = $disabled;
35
return
$result;
36
}
37
38
public
function
getPosition() :
BlockPosition
{ return $this->position; }
39
40
public
function
getSlot() : int{ return $this->slot; }
41
42
public
function
isDisabled() : bool{ return $this->disabled; }
43
44
protected
function
decodePayload
(
PacketSerializer
$in) : void{
45
$x = $in->getLInt();
46
$y = $in->
getLInt
();
47
$z = $in->
getLInt
();
48
$this->position =
new
BlockPosition
($x, $y, $z);
49
$this->slot = $in->
getByte
();
50
$this->disabled = $in->
getBool
();
51
}
52
53
protected
function
encodePayload
(
PacketSerializer
$out) : void{
54
$out->putLInt($this->position->getX());
55
$out->putLInt($this->position->getY());
56
$out->putLInt($this->position->getZ());
57
$out->putByte($this->slot);
58
$out->putBool($this->disabled);
59
}
60
61
public
function
handle
(
PacketHandlerInterface
$handler) : bool{
62
return $handler->handlePlayerToggleCrafterSlotRequest($this);
63
}
64
}
pocketmine\network\mcpe\protocol\DataPacket
Definition
DataPacket.php:21
pocketmine\network\mcpe\protocol\PlayerToggleCrafterSlotRequestPacket
Definition
PlayerToggleCrafterSlotRequestPacket.php:20
pocketmine\network\mcpe\protocol\PlayerToggleCrafterSlotRequestPacket\encodePayload
encodePayload(PacketSerializer $out)
Definition
PlayerToggleCrafterSlotRequestPacket.php:53
pocketmine\network\mcpe\protocol\PlayerToggleCrafterSlotRequestPacket\decodePayload
decodePayload(PacketSerializer $in)
Definition
PlayerToggleCrafterSlotRequestPacket.php:44
pocketmine\network\mcpe\protocol\PlayerToggleCrafterSlotRequestPacket\handle
handle(PacketHandlerInterface $handler)
Definition
PlayerToggleCrafterSlotRequestPacket.php:61
pocketmine\network\mcpe\protocol\PlayerToggleCrafterSlotRequestPacket\create
static create(BlockPosition $position, int $slot, bool $disabled)
Definition
PlayerToggleCrafterSlotRequestPacket.php:30
pocketmine\network\mcpe\protocol\serializer\PacketSerializer
Definition
bedrock-protocol/src/serializer/PacketSerializer.php:66
pocketmine\network\mcpe\protocol\types\BlockPosition
Definition
BlockPosition.php:19
pocketmine\utils\BinaryStream\getBool
getBool()
Definition
BinaryStream.php:105
pocketmine\utils\BinaryStream\getByte
getByte()
Definition
BinaryStream.php:117
pocketmine\utils\BinaryStream\getLInt
getLInt()
Definition
BinaryStream.php:205
pocketmine\network\mcpe\protocol\PacketHandlerInterface
Definition
PacketHandlerInterface.php:20
pocketmine\network\mcpe\protocol\ServerboundPacket
Definition
ServerboundPacket.php:17
vendor
pocketmine
bedrock-protocol
src
PlayerToggleCrafterSlotRequestPacket.php
Generated by
1.12.0