Package net.minecraft.resource
Class ResourceImpl
java.lang.Object
net.minecraft.resource.ResourceImpl
- All Implemented Interfaces:
Closeable,AutoCloseable,Resource
public class ResourceImpl extends Object implements Resource
-
Field Summary
Fields Modifier and Type Field Description private Identifieridprivate InputStreaminputStreamprivate JsonObjectmetadataprivate InputStreammetaInputStreamprivate StringpackNameprivate booleanreadMetadata -
Constructor Summary
Constructors Constructor Description ResourceImpl(String packName, Identifier id, InputStream inputStream, InputStream metaInputStream) -
Method Summary
Modifier and Type Method Description voidclose()booleanequals(Object o)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.inthashCode()booleanhasMetadata()
-
Field Details
-
packName
-
id
-
inputStream
-
metaInputStream
-
readMetadata
@Environment(CLIENT) private boolean readMetadata -
metadata
-
-
Constructor Details
-
ResourceImpl
public ResourceImpl(String packName, Identifier id, InputStream inputStream, @Nullable InputStream metaInputStream)
-
-
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
Returns the input stream of this resource.This input stream is closed when this resource is closed.
- Specified by:
getInputStreamin interfaceResource
-
hasMetadata
@Environment(CLIENT) public boolean hasMetadata() -
getMetadata
Returns a metadata of this resource by themetaReader, ornullif no such metadata exists.- Specified by:
getMetadatain interfaceResource- Parameters:
metaReader- the metadata reader
-
getResourcePackName
Returns the user-friendly name of the pack this resource is from.- Specified by:
getResourcePackNamein interfaceResource
-
equals
-
hashCode
public int hashCode() -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-