Interface ResourcePack
-
public interface ResourcePack
Represents a resource pack that can be sent to the client.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ResourcePack.Factory
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static ResourcePack
fromUri(java.net.URI uri)
Creates aResourcePack
from a URI and tries to download and hash it.static ResourcePack
fromUriUnchecked(java.net.URI uri)
Creates aResourcePack
from a URI, without checking ("unchecked") if there is a valid pack at the URI.java.util.Optional<java.lang.String>
hash()
If this resource pack was initialized throughfromUri(URI)
, the hash, as calculated withcom.google.common.hash.Hashing.sha1().hashBytes( com.google.common.io.Files.toByteArray(resourcepackfile) ).toString();
.java.lang.String
id()
Gets the ID of this resource pack.java.lang.String
name()
Gets the name of this resource pack.java.net.URI
uri()
Gets the URI associated with this resource pack.
-
-
-
Method Detail
-
fromUri
static ResourcePack fromUri(java.net.URI uri) throws java.io.FileNotFoundException
Creates aResourcePack
from a URI and tries to download and hash it.- Parameters:
uri
- The URI to look in- Returns:
- A ResourcePack with the specified URI
- Throws:
java.io.FileNotFoundException
- If a valid resource pack could not be downloaded from the URI
-
fromUriUnchecked
static ResourcePack fromUriUnchecked(java.net.URI uri)
Creates aResourcePack
from a URI, without checking ("unchecked") if there is a valid pack at the URI.- Parameters:
uri
- The URI to look in- Returns:
- A ResourcePack with the specified URI
-
uri
java.net.URI uri()
Gets the URI associated with this resource pack.- Returns:
- The URI associated with this resource pack.
-
name
java.lang.String name()
Gets the name of this resource pack. This is the filename of the pack zip file, with all non-word characters removed. Note to implementers: The name MUST be calculated like above, or this API will not work.- Returns:
- The name of this resource pack. This is the filename of the pack .zip, with all non-word characters removed
-
id
java.lang.String id()
Gets the ID of this resource pack.- Returns:
- the ID of this resource pack
-
hash
java.util.Optional<java.lang.String> hash()
If this resource pack was initialized throughfromUri(URI)
, the hash, as calculated withcom.google.common.hash.Hashing.sha1().hashBytes( com.google.common.io.Files.toByteArray(resourcepackfile) ).toString();
.- Returns:
- The hash of this pack, if present
-
-