Class MultiResourcePack
- java.lang.Object
-
- net.minecraft.modding.api.game.client.resources.ResourcePack
-
- net.minecraft.modding.api.game.client.resources.MultiResourcePack
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
ListResourcePack
,ResourceManager
public abstract class MultiResourcePack extends ResourcePack
Wraps multipleResourcePack
s into one.
-
-
Constructor Summary
Constructors Constructor Description MultiResourcePack()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.util.stream.Stream<Resource>
findResources(@Nullable java.lang.String namespace, java.lang.String directory, java.lang.String extension)
Finds allResource
s that match the given query.java.util.Optional<Resource>
getResource(ResourceLocation location)
Returns aResource
that exists at the given location.java.util.stream.Stream<Resource>
getResources(java.lang.String path)
Returns allResource
s that are at the given path, regardless of namespace.java.util.stream.Stream<Resource>
getResources(ResourceLocation location)
Returns allResource
s that match the given location.protected abstract java.util.stream.Stream<ResourcePack>
getSubPacks()
-
Methods inherited from class net.minecraft.modding.api.game.client.resources.ResourcePack
close, getDescription, getName, getThumbnail, isLegacyTexturePack
-
-
-
-
Method Detail
-
getSubPacks
protected abstract java.util.stream.Stream<ResourcePack> getSubPacks()
-
getResources
public java.util.stream.Stream<Resource> getResources(ResourceLocation location)
Description copied from class:ResourcePack
Returns allResource
s that match the given location. An empty namespace will search outside theassets/
dir. This may return multiple resources in the case of aMultiResourcePack
.- Overrides:
getResources
in classResourcePack
- Parameters:
location
- The exact location of the resources.- Returns:
- A stream that iterates over the
Resource
s.
-
getResources
public java.util.stream.Stream<Resource> getResources(java.lang.String path)
Description copied from class:ResourcePack
Returns allResource
s that are at the given path, regardless of namespace. This includes the empty namespace only ifResourcePack.isLegacyTexturePack()
returns true.- Specified by:
getResources
in classResourcePack
- Parameters:
path
- The path to search at. All namespaces will be checked.- Returns:
- A stream that iterates over the
Resource
s.
-
getResource
public java.util.Optional<Resource> getResource(ResourceLocation location)
Description copied from class:ResourcePack
Returns aResource
that exists at the given location. An empty namespace will search outside theassets/
dir.- Specified by:
getResource
in classResourcePack
- Parameters:
location
- The exact location of the resource.- Returns:
- A present optional if the resource exists,
Optional.empty()
otherwise.
-
findResources
public java.util.stream.Stream<Resource> findResources(@Nullable @Nullable java.lang.String namespace, java.lang.String directory, java.lang.String extension)
Description copied from class:ResourcePack
Finds allResource
s that match the given query. UnlikeResourcePack.getResources(ResourceLocation)
, this will only return the first occurrence of a resource in the case of aMultiResourcePack
.- Specified by:
findResources
in classResourcePack
- Parameters:
namespace
-null
to search all namespaces. A specific namespace to search otherwise.directory
- The directory to search through. End with/**
to search recursively.extension
- The extension to require files to end with. Should be prefixed with a dot (e.g.".json"
). Use""
to ignore file extension.- Returns:
- A stream that iterates over all the found
Resource
s.
-
-