Class ResourceUtils

java.lang.Object
codechicken.lib.util.ResourceUtils

public class ResourceUtils extends Object
Created by covers1624 on 11/07/2017.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.server.packs.resources.Resource
    getResource(net.minecraft.resources.ResourceLocation location)
    Get's an IResource from the resource manager.
    getResourceAsStream(net.minecraft.resources.ResourceLocation resource)
    Retrieves an InputStream from the standard Vanilla IReloadableResourceManager.
    static net.minecraft.server.packs.resources.ReloadableResourceManager
    Grabs the resource manager.
    static List<String>
    loadResource(net.minecraft.server.packs.resources.ResourceProvider resourceProvider, net.minecraft.resources.ResourceLocation loc)
    Loads the given ResourceLocation with the given ResourceProvider into a list of UTF-8 Strings.
    static void
    registerReloadListener(net.minecraft.server.packs.resources.ResourceManagerReloadListener reloadListener)
    Registers a IResourceManagerReloadListener to MC's resource manager.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 given ResourceLocation with the given ResourceProvider into a list of UTF-8 Strings.
      Parameters:
      resourceProvider - The ResourceProvider.
      loc - The ResourceLocation.
      Returns:
      The UTF-8 lines of the resource.