Interface InputStreamSource

All Known Subinterfaces:
PathAwareInputStreamSource, ResourceGenerator
All Known Implementing Classes:
DummyGenerator, TagSupplier.TagBakery, TextureGenerator, TextureMetaGenerator
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface InputStreamSource
An object that can provide an input stream supplier at a given location.
  • Method Summary

    Modifier and Type
    Method
    Description
    default @Nullable String
    createCacheKey(net.minecraft.resources.ResourceLocation outRl, ResourceGenerationContext context)
    Create a key that can be uniquely used to identify the resource this generator will generate.
    @Nullable net.minecraft.server.packs.resources.IoSupplier<InputStream>
    get(net.minecraft.resources.ResourceLocation outRl, ResourceGenerationContext context)
    Gets an input stream for the given resource location.
  • Method Details

    • get

      @Nullable net.minecraft.server.packs.resources.IoSupplier<InputStream> get(net.minecraft.resources.ResourceLocation outRl, ResourceGenerationContext context)
      Gets an input stream for the given resource location.
      Parameters:
      outRl - ResourceLocation to get the input stream for.
      context - ResourceGenerationContext containing information about when and where the resource is being generated.
      Returns:
      Supplier for an InputStream for the location. Should be null if the resource cannot be loaded.
    • createCacheKey

      default @Nullable String createCacheKey(net.minecraft.resources.ResourceLocation outRl, ResourceGenerationContext context)
      Create a key that can be uniquely used to identify the resource this generator will generate. Note that this is used for caching across reloads, and so should incorporate any resources that may be used to generate the resource. If this is not possible, return null.
      Parameters:
      outRl - the resource location that will be generated
      context - the context that the resource will be generated in. Resources can safely be accessed in this context
      Returns:
      a key that can be used to uniquely identify the resource, or null if this is not possible