Package codechicken.lib.util
Class ResourceUtils
java.lang.Object
codechicken.lib.util.ResourceUtils
Created by covers1624 on 11/07/2017.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.server.packs.resources.ResourcegetResource(net.minecraft.resources.ResourceLocation location) Get's an IResource from the resource manager.static InputStreamgetResourceAsStream(net.minecraft.resources.ResourceLocation resource) Retrieves an InputStream from the standard Vanilla IReloadableResourceManager.static net.minecraft.server.packs.resources.ReloadableResourceManagerGrabs the resource manager.loadResource(net.minecraft.server.packs.resources.ResourceProvider resourceProvider, net.minecraft.resources.ResourceLocation loc) Loads the givenResourceLocationwith the givenResourceProviderinto a list of UTF-8 Strings.static voidregisterReloadListener(net.minecraft.server.packs.resources.ResourceManagerReloadListener reloadListener) Registers a IResourceManagerReloadListener to MC's resource manager.
-
Constructor Details
-
ResourceUtils
public ResourceUtils()
-
-
Method Details
-
getResourceAsStream
public static InputStream getResourceAsStream(net.minecraft.resources.ResourceLocation resource) throws IOException Retrieves an InputStream from the standard Vanilla IReloadableResourceManager.- Parameters:
resource- The resource.- Returns:
- The InputStream.
- Throws:
IOException- If the file is not found or some other IO error occurred.
-
getResourceManager
public static net.minecraft.server.packs.resources.ReloadableResourceManager getResourceManager()Grabs the resource manager.- Returns:
- The resource manager.
-
getResource
public static net.minecraft.server.packs.resources.Resource getResource(net.minecraft.resources.ResourceLocation location) throws IOException Get's an IResource from the resource manager.- Parameters:
location- The resource to get.- Returns:
- The gotten resource.
- Throws:
IOException- If the resource doesn't exist, or some other IO error occurred.
-
registerReloadListener
public static void registerReloadListener(net.minecraft.server.packs.resources.ResourceManagerReloadListener reloadListener) Registers a IResourceManagerReloadListener to MC's resource manager.- Parameters:
reloadListener- The listener.
-
loadResource
public static List<String> loadResource(net.minecraft.server.packs.resources.ResourceProvider resourceProvider, net.minecraft.resources.ResourceLocation loc) Loads the givenResourceLocationwith the givenResourceProviderinto a list of UTF-8 Strings.- Parameters:
resourceProvider- TheResourceProvider.loc- TheResourceLocation.- Returns:
- The UTF-8 lines of the resource.
-