Class PathPackResources

java.lang.Object
net.minecraft.server.packs.AbstractPackResources
io.github.vampirestudios.vampirelib.api.datagen.PathPackResources
All Implemented Interfaces:
AutoCloseable, net.minecraft.server.packs.PackResources

public class PathPackResources extends net.minecraft.server.packs.AbstractPackResources
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 Summary

    Nested classes/interfaces inherited from interface net.minecraft.server.packs.PackResources

    net.minecraft.server.packs.PackResources.ResourceOutput
  • Field Summary

    Fields inherited from interface net.minecraft.server.packs.PackResources

    METADATA_EXTENSION, PACK_META
  • Constructor Summary

    Constructors
    Constructor
    Description
    PathPackResources(String packId, boolean isBuiltin, Path source)
    Constructs a java.nio.Path-based resource pack.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    getNamespaces(net.minecraft.server.packs.PackType type)
     
    net.minecraft.server.packs.resources.IoSupplier<InputStream>
    getResource(net.minecraft.server.packs.PackType type, net.minecraft.resources.ResourceLocation location)
     
    @Nullable net.minecraft.server.packs.resources.IoSupplier<InputStream>
     
    Returns the source path containing the resource pack.
    void
    init(net.minecraft.server.packs.PackType packType)
     
    void
     
    void
    listResources(net.minecraft.server.packs.PackType type, String namespace, String path, net.minecraft.server.packs.PackResources.ResourceOutput resourceOutput)
     
    protected Path
    resolve(String... paths)
    Implement to return a file or folder path for the given set of path components.
     

    Methods inherited from class net.minecraft.server.packs.AbstractPackResources

    getMetadataFromStream, getMetadataSection, isBuiltin, packId

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • PathPackResources

      public PathPackResources(String packId, boolean isBuiltin, Path source)
      Constructs 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

    • initForNamespace

      public void initForNamespace(String namespace)
    • init

      public void init(net.minecraft.server.packs.PackType packType)
    • getSource

      public Path getSource()
      Returns the source path containing the resource pack. This is used for error display.
      Returns:
      the root path of the resources.
    • resolve

      protected Path resolve(String... paths)
      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.
    • getRootResource

      @Nullable public @Nullable net.minecraft.server.packs.resources.IoSupplier<InputStream> getRootResource(String... paths)
    • listResources

      public void listResources(net.minecraft.server.packs.PackType type, String namespace, String path, net.minecraft.server.packs.PackResources.ResourceOutput resourceOutput)
    • getNamespaces

      public Set<String> getNamespaces(net.minecraft.server.packs.PackType type)
    • getResource

      public net.minecraft.server.packs.resources.IoSupplier<InputStream> getResource(net.minecraft.server.packs.PackType type, net.minecraft.resources.ResourceLocation location)
    • close

      public void close()
    • toString

      public String toString()
      Overrides:
      toString in class Object