Package net.minecraftforge.resource
Class PathResourcePack
java.lang.Object
net.minecraft.server.packs.AbstractPackResources
net.minecraftforge.resource.PathResourcePack
- 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.
-
Field Summary
FieldsFields inherited from class net.minecraft.server.packs.AbstractPackResources
fileFields inherited from interface net.minecraft.server.packs.PackResources
METADATA_EXTENSION, PACK_META -
Constructor Summary
ConstructorsConstructorDescriptionPathResourcePack(String packName, Path source) Constructs a java.nio.Path-based resource pack. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()getName()Returns the identifying name for the pack.getNamespaces(PackType type) protected InputStreamgetResource(String name) getResource(PackType type, ResourceLocation location) getResources(PackType type, String resourceNamespace, String pathIn, int maxDepth, Predicate<String> filter) Returns the source path containing the resource pack.protected booleanhasResource(String name) booleanhasResource(PackType type, ResourceLocation location) 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.AbstractPackResources
getMetadataFromStream, getMetadataSection, getRelativePath, getRootResource, logWarningMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraftforge.common.extensions.IForgePackResources
isHidden
-
Field Details
-
source
-
packName
-
-
Constructor Details
-
PathResourcePack
Constructs a java.nio.Path-based resource pack.- Parameters:
packName- the identifying name of the pack. This name should be unique within the pack finder, preferably the name of the file or folder containing the resources.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
-
getSource
Returns the source path containing the resource pack. This is used for error display.- Returns:
- the root path of the resources.
-
getName
Returns the identifying name for the pack.- Specified by:
getNamein interfacePackResources- Overrides:
getNamein classAbstractPackResources- Returns:
- the identifier of the pack.
-
resolve
Implement 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.
-
getResource
- Specified by:
getResourcein classAbstractPackResources- Throws:
IOException
-
hasResource
- Specified by:
hasResourcein classAbstractPackResources
-
getResources
public Collection<ResourceLocation> getResources(PackType type, String resourceNamespace, String pathIn, int maxDepth, Predicate<String> filter) -
getNamespaces
-
getResource
- Specified by:
getResourcein interfacePackResources- Overrides:
getResourcein classAbstractPackResources- Throws:
IOException
-
hasResource
- Specified by:
hasResourcein interfacePackResources- Overrides:
hasResourcein classAbstractPackResources
-
close
public void close() -
toString
- Overrides:
toStringin classAbstractPackResources
-