0
0
mirror of https://github.com/pmmp/BedrockProtocol.git synced 2025-02-23 11:36:15 +00:00
BedrockProtocol/src/ContainerClosePacket.php
2024-06-13 18:34:14 +01:00

53 lines
1.5 KiB
PHP

<?php
/*
* This file is part of BedrockProtocol.
* Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol>
*
* BedrockProtocol 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.
*/
declare(strict_types=1);
namespace pocketmine\network\mcpe\protocol;
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class ContainerClosePacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::CONTAINER_CLOSE_PACKET;
public int $windowId;
public int $windowType;
public bool $server = false;
/**
* @generate-create-func
*/
public static function create(int $windowId, int $windowType, bool $server) : self{
$result = new self;
$result->windowId = $windowId;
$result->windowType = $windowType;
$result->server = $server;
return $result;
}
protected function decodePayload(PacketSerializer $in) : void{
$this->windowId = $in->getByte();
$this->windowType = $in->getByte();
$this->server = $in->getBool();
}
protected function encodePayload(PacketSerializer $out) : void{
$out->putByte($this->windowId);
$out->putByte($this->windowType);
$out->putBool($this->server);
}
public function handle(PacketHandlerInterface $handler) : bool{
return $handler->handleContainerClose($this);
}
}