ResourcePackFile
Namespace Mc.Scripting.Content · Kind class (sealed)
public sealed class ResourcePackFileA built resource pack: the zip, its SHA-1 and the id clients know it by.
Properties
Section titled “Properties”| Member | Description |
|---|---|
byte[] Bytes { get; } |
The zip. |
Uuid Id { get; } |
The pack id (derived from the name: a pack of the same name replaces the older one on the client). |
string Name { get; } |
The pack name. |
string Sha1 { get; } |
The SHA-1 of the zip (40 lower-case hex characters). |
int Size { get; } |
The size of the zip in bytes. |
public byte[] Bytes { get; }The zip.
public Uuid Id { get; }The pack id (derived from the name: a pack of the same name replaces the older one on the client).
public string Name { get; }The pack name.
public string Sha1 { get; }The SHA-1 of the zip (40 lower-case hex characters).
public int Size { get; }The size of the zip in bytes.
Methods
Section titled “Methods”| Member | Description |
|---|---|
ResourcePack Publish(bool required = false, Component? prompt = null) |
Hosts the zip with ResourcePackHost and returns the description a client needs. |
void SendTo(Player player, bool required = false, Component? prompt = null) |
Hosts the pack (see ResourcePackFile.Publish) and asks a player to download it. |
ResourcePack ToResourcePack(string url, bool required = false, Component? prompt = null) |
The pack as the packet a client needs, for a URL you host yourself. |
void WriteTo(string path) |
Writes the zip to a file. |
Publish
Section titled “Publish”public ResourcePack Publish(bool required = false, Component? prompt = null)Hosts the zip with ResourcePackHost and returns the description a client needs.
Parameters
| Name | Type | Description |
|---|---|---|
required |
bool = false |
Whether the player must accept it. |
prompt |
Component? = null |
Text shown in the download prompt. |
Returns ResourcePack: The resource pack description.
Throws
System.InvalidOperationException: The built-in host is off (content.pack_host_portis 0 andResourcePackHost.Startwas not called).
SendTo
Section titled “SendTo”public void SendTo(Player player, bool required = false, Component? prompt = null)Hosts the pack (see ResourcePackFile.Publish) and asks a player to download it.
Parameters
| Name | Type | Description |
|---|---|---|
player |
Player |
The player. |
required |
bool = false |
Whether he must accept it. |
prompt |
Component? = null |
Text shown in the download prompt. |
ToResourcePack
Section titled “ToResourcePack”public ResourcePack ToResourcePack(string url, bool required = false, Component? prompt = null)The pack as the packet a client needs, for a URL you host yourself.
Parameters
| Name | Type | Description |
|---|---|---|
url |
string |
Where the zip is downloadable. |
required |
bool = false |
Whether the player must accept it (declining kicks him). |
prompt |
Component? = null |
Text shown in the download prompt. |
Returns ResourcePack: The resource pack description.
WriteTo
Section titled “WriteTo”public void WriteTo(string path)Writes the zip to a file.
Parameters
| Name | Type | Description |
|---|---|---|
path |
string |
The file path. |
See also
Section titled “See also”Component · Player · ResourcePack · Uuid