Package net.minecraftforge.resource
Class PathPackResources
java.lang.Object
net.minecraft.server.packs.AbstractPackResources
net.minecraftforge.resource.PathPackResources
- All Implemented Interfaces:
- AutoCloseable,- PackResources,- IForgePackResources
Defines a resource pack from an arbitrary Path.
 
This is primarily intended to support including optional resource packs inside a mod, such as to have alternative textures to use along with Programmer Art, or optional alternative recipes for compatibility ot to replace vanilla recipes.
- 
Nested Class SummaryNested classes/interfaces inherited from interface net.minecraft.server.packs.PackResourcesPackResources.ResourceOutput
- 
Field SummaryFieldsFields inherited from interface net.minecraft.server.packs.PackResourcesMETADATA_EXTENSION, PACK_META
- 
Constructor SummaryConstructorsConstructorDescriptionPathPackResources(String packId, boolean isBuiltin, Path source) Constructs a java.nio.Path-based resource pack.
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()getNamespaces(PackType type) private static String[]getPathFromLocation(PackType type, ResourceLocation location) getResource(PackType type, ResourceLocation location) @Nullable IoSupplier<InputStream>getRootResource(String... paths) Returns the source path containing the resource pack.voidlistResources(PackType type, String namespace, String path, PackResources.ResourceOutput resourceOutput) protected PathImplement to return a file or folder path for the given set of path components.toString()Methods inherited from class net.minecraft.server.packs.AbstractPackResourcesgetMetadataFromStream, getMetadataSection, isBuiltin, packIdMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraftforge.common.extensions.IForgePackResourcesgetChildren, isHidden
- 
Field Details- 
LOGGERprivate static final org.slf4j.Logger LOGGER
- 
source
 
- 
- 
Constructor Details- 
PathPackResourcesConstructs a java.nio.Path-based resource pack.- Parameters:
- packId- the identifier of the pack. This identifier should be unique within the pack finder, preferably the name of the file or folder containing the resources.
- isBuiltin- whether this pack resources should be considered builtin
- source- the root path of the pack. This needs to point to the folder that contains "assets" and/or "data", not the asset folder itself!
 
 
- 
- 
Method Details- 
getSourceReturns the source path containing the resource pack. This is used for error display.- Returns:
- the root path of the resources.
 
- 
resolveImplement to return a file or folder path for the given set of path components.- Parameters:
- paths- One or more path strings to resolve. Can include slash-separated paths.
- Returns:
- the resulting path, which may not exist.
 
- 
getRootResource
- 
listResourcespublic void listResources(PackType type, String namespace, String path, PackResources.ResourceOutput resourceOutput) 
- 
getNamespaces
- 
getNamespacesFromDisk
- 
getResource
- 
getPathFromLocation
- 
closepublic void close()
- 
toString- Overrides:
- toStringin class- AbstractPackResources
 
 
-