Package net.minecraft.resource
Interface Resource
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
ResourceImpl
public interface Resource extends Closeable
A resource of binary data.
The resource must be closed before disposal to avoid resource leaks.
-
Method Summary
Modifier and Type Method Description IdentifiergetId()Returns the location of this resource.InputStreamgetInputStream()Returns the input stream of this resource.<T> TgetMetadata(ResourceMetadataReader<T> metaReader)Returns a metadata of this resource by themetaReader, ornullif no such metadata exists.StringgetResourcePackName()Returns the user-friendly name of the pack this resource is from.
-
Method Details
-
getId
Returns the location of this resource.Within each resource pack, this location is a unique identifer for a resource; however, in a resource manager, there may be multiple resources with the same location available.
-
getInputStream
InputStream getInputStream()Returns the input stream of this resource.This input stream is closed when this resource is closed.
-
getMetadata
Returns a metadata of this resource by themetaReader, ornullif no such metadata exists.- Parameters:
metaReader- the metadata reader
-
getResourcePackName
String getResourcePackName()Returns the user-friendly name of the pack this resource is from.
-