PocketMine-MP 5.15.1 git-5ef247620a7c6301a849b54e5ef1009217729fc8
ContainerSetDataPacket.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
13declare(strict_types=1);
14
15namespace pocketmine\network\mcpe\protocol;
16
18
20 public const NETWORK_ID = ProtocolInfo::CONTAINER_SET_DATA_PACKET;
21
22 public const PROPERTY_FURNACE_SMELT_PROGRESS = 0;
23 public const PROPERTY_FURNACE_REMAINING_FUEL_TIME = 1;
24 public const PROPERTY_FURNACE_MAX_FUEL_TIME = 2;
25 public const PROPERTY_FURNACE_STORED_XP = 3;
26 public const PROPERTY_FURNACE_FUEL_AUX = 4;
27
28 public const PROPERTY_BREWING_STAND_BREW_TIME = 0;
29 public const PROPERTY_BREWING_STAND_FUEL_AMOUNT = 1;
30 public const PROPERTY_BREWING_STAND_FUEL_TOTAL = 2;
31
32 public int $windowId;
33 public int $property;
34 public int $value;
35
39 public static function create(int $windowId, int $property, int $value) : self{
40 $result = new self;
41 $result->windowId = $windowId;
42 $result->property = $property;
43 $result->value = $value;
44 return $result;
45 }
46
47 protected function decodePayload(PacketSerializer $in) : void{
48 $this->windowId = $in->getByte();
49 $this->property = $in->getVarInt();
50 $this->value = $in->getVarInt();
51 }
52
53 protected function encodePayload(PacketSerializer $out) : void{
54 $out->putByte($this->windowId);
55 $out->putVarInt($this->property);
56 $out->putVarInt($this->value);
57 }
58
59 public function handle(PacketHandlerInterface $handler) : bool{
60 return $handler->handleContainerSetData($this);
61 }
62}
static create(int $windowId, int $property, int $value)