PocketMine-MP 5.19.1 git-5cc1068cd43264d3363295eb8d6901e02f467897
ResourcePackInfoEntry.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 private bool $isRtxCapable = false
30 ){}
31
32 public function getPackId() : string{
33 return $this->packId;
34 }
35
36 public function getVersion() : string{
37 return $this->version;
38 }
39
40 public function getSizeBytes() : int{
41 return $this->sizeBytes;
42 }
43
44 public function getEncryptionKey() : string{
45 return $this->encryptionKey;
46 }
47
48 public function getSubPackName() : string{
49 return $this->subPackName;
50 }
51
52 public function getContentId() : string{
53 return $this->contentId;
54 }
55
56 public function hasScripts() : bool{
57 return $this->hasScripts;
58 }
59
60 public function isAddonPack() : bool{ return $this->isAddonPack; }
61
62 public function isRtxCapable() : bool{ return $this->isRtxCapable; }
63
64 public function write(PacketSerializer $out) : void{
65 $out->putString($this->packId);
66 $out->putString($this->version);
67 $out->putLLong($this->sizeBytes);
68 $out->putString($this->encryptionKey);
69 $out->putString($this->subPackName);
70 $out->putString($this->contentId);
71 $out->putBool($this->hasScripts);
72 $out->putBool($this->isAddonPack);
73 $out->putBool($this->isRtxCapable);
74 }
75
76 public static function read(PacketSerializer $in) : self{
77 $uuid = $in->getString();
78 $version = $in->getString();
79 $sizeBytes = $in->getLLong();
80 $encryptionKey = $in->getString();
81 $subPackName = $in->getString();
82 $contentId = $in->getString();
83 $hasScripts = $in->getBool();
84 $isAddonPack = $in->getBool();
85 $rtxCapable = $in->getBool();
86 return new self($uuid, $version, $sizeBytes, $encryptionKey, $subPackName, $contentId, $hasScripts, $isAddonPack, $rtxCapable);
87 }
88}