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