PocketMine-MP 5.18.2 git-00e39821f06a4b6d728d35053c2621dbb19369ff
BehaviorPackInfoEntry.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\types\resourcepacks;
16
18
20 public function __construct(
21 private string $packId,
22 private string $version,
23 private int $sizeBytes,
24 private string $encryptionKey = "",
25 private string $subPackName = "",
26 private string $contentId = "",
27 private bool $hasScripts = false,
28 private bool $isAddonPack = false
29 ){}
30
31 public function getPackId() : string{
32 return $this->packId;
33 }
34
35 public function getVersion() : string{
36 return $this->version;
37 }
38
39 public function getSizeBytes() : int{
40 return $this->sizeBytes;
41 }
42
43 public function getEncryptionKey() : string{
44 return $this->encryptionKey;
45 }
46
47 public function getSubPackName() : string{
48 return $this->subPackName;
49 }
50
51 public function getContentId() : string{
52 return $this->contentId;
53 }
54
55 public function hasScripts() : bool{
56 return $this->hasScripts;
57 }
58
59 public function isAddonPack() : bool{ return $this->isAddonPack; }
60
61 public function write(PacketSerializer $out) : void{
62 $out->putString($this->packId);
63 $out->putString($this->version);
64 $out->putLLong($this->sizeBytes);
65 $out->putString($this->encryptionKey);
66 $out->putString($this->subPackName);
67 $out->putString($this->contentId);
68 $out->putBool($this->hasScripts);
69 $out->putBool($this->isAddonPack);
70 }
71
72 public static function read(PacketSerializer $in) : self{
73 $uuid = $in->getString();
74 $version = $in->getString();
75 $sizeBytes = $in->getLLong();
76 $encryptionKey = $in->getString();
77 $subPackName = $in->getString();
78 $contentId = $in->getString();
79 $hasScripts = $in->getBool();
80 $isAddonPack = $in->getBool();
81 return new self($uuid, $version, $sizeBytes, $encryptionKey, $subPackName, $contentId, $hasScripts, $isAddonPack);
82 }
83}