Skip to content

Commit

Permalink
Fix ResourcePackInfoEntry
Browse files Browse the repository at this point in the history
  • Loading branch information
AkmalFairuz committed Oct 24, 2024
1 parent 7eeffd9 commit 78663f9
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/types/resourcepacks/ResourcePackInfoEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public function __construct(
private string $contentId = "",
private bool $hasScripts = false,
private bool $isAddonPack = false,
private bool $isRtxCapable = false
private bool $isRtxCapable = false,
private string $cdnUrl = ""
){}

public function getPackId() : string{
Expand Down Expand Up @@ -64,6 +65,10 @@ public function isAddonPack(): bool{

public function isRtxCapable() : bool{ return $this->isRtxCapable; }

public function getCdnUrl(): string {
return $this->cdnUrl;
}

public function write(PacketSerializer $out) : void{
$out->putString($this->packId);
$out->putString($this->version);
Expand All @@ -76,6 +81,9 @@ public function write(PacketSerializer $out) : void{
$out->putBool($this->isAddonPack);
}
$out->putBool($this->isRtxCapable);
if($out->getProtocol() >= ProtocolInfo::PROTOCOL_748) {
$out->putString($this->cdnUrl);
}
}

public static function read(PacketSerializer $in) : self{
Expand All @@ -90,6 +98,7 @@ public static function read(PacketSerializer $in) : self{
$isAddonPack = $in->getBool();
}
$rtxCapable = $in->getBool();
return new self($uuid, $version, $sizeBytes, $encryptionKey, $subPackName, $contentId, $hasScripts, $isAddonPack ?? false, $rtxCapable);
$cdnUrl = $in->getProtocol() >= ProtocolInfo::PROTOCOL_748 ? $in->getString() : "";
return new self($uuid, $version, $sizeBytes, $encryptionKey, $subPackName, $contentId, $hasScripts, $isAddonPack ?? false, $rtxCapable, $cdnUrl);
}
}

0 comments on commit 78663f9

Please sign in to comment.