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