java.lang.Object
dev.lukebemish.dynamicassetgenerator.api.generators.DummyGenerator
All Implemented Interfaces:
InputStreamSource, PathAwareInputStreamSource, ResourceGenerator

public class DummyGenerator extends Object implements ResourceGenerator
A resource generator that generates no resources. Useful for overriding other resource generators in lower priority packs.
  • Field Details

    • INSTANCE

      public static final DummyGenerator INSTANCE
    • CODEC

      public static final com.mojang.serialization.MapCodec<DummyGenerator> CODEC
  • Method Details

    • get

      public net.minecraft.server.packs.resources.IoSupplier<InputStream> get(net.minecraft.resources.ResourceLocation outRl, ResourceGenerationContext context)
      Description copied from interface: InputStreamSource
      Gets an input stream for the given resource location.
      Specified by:
      get in interface InputStreamSource
      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.
    • getLocations

      public @NonNull Set<net.minecraft.resources.ResourceLocation> getLocations(ResourceGenerationContext context)
      Specified by:
      getLocations in interface PathAwareInputStreamSource
      Returns:
      the locations that this InputStreamSource can provide resources at.
    • persistentCacheData

      public <T> @NonNull com.mojang.serialization.DataResult<T> persistentCacheData(com.mojang.serialization.DynamicOps<T> ops, net.minecraft.resources.ResourceLocation location, ResourceGenerationContext context)
      Description copied from interface: ResourceGenerator
      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.
      Specified by:
      persistentCacheData in interface ResourceGenerator
      Parameters:
      ops - DynamicOps to encode the unique key with.
      location - 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
    • codec

      public com.mojang.serialization.MapCodec<? extends ResourceGenerator> codec()
      Specified by:
      codec in interface ResourceGenerator
      Returns:
      A codec that can serialize this resource generator.