Class DummyGenerator
java.lang.Object
dev.lukebemish.dynamicassetgenerator.api.generators.DummyGenerator
- All Implemented Interfaces:
InputStreamSource,PathAwareInputStreamSource,ResourceGenerator
A resource generator that generates no resources. Useful for overriding other resource generators in lower priority
packs.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<DummyGenerator> static final DummyGeneratorFields inherited from interface dev.lukebemish.dynamicassetgenerator.api.ResourceGenerator
PERSISTENT_CACHE_KEY -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.MapCodec<? extends ResourceGenerator> codec()net.minecraft.server.packs.resources.IoSupplier<InputStream> get(net.minecraft.resources.ResourceLocation outRl, ResourceGenerationContext context) Gets an input stream for the given resource location.@NonNull Set<net.minecraft.resources.ResourceLocation> getLocations(ResourceGenerationContext context) <T> @NonNull com.mojang.serialization.DataResult<T> persistentCacheData(com.mojang.serialization.DynamicOps<T> ops, net.minecraft.resources.ResourceLocation location, ResourceGenerationContext context) Create a key that can be uniquely used to identify the resource this generator will generate.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.lukebemish.dynamicassetgenerator.api.ResourceGenerator
createCacheKey
-
Field Details
-
INSTANCE
-
CODEC
-
-
Method Details
-
get
public net.minecraft.server.packs.resources.IoSupplier<InputStream> get(net.minecraft.resources.ResourceLocation outRl, ResourceGenerationContext context) Description copied from interface:InputStreamSourceGets an input stream for the given resource location.- Specified by:
getin interfaceInputStreamSource- Parameters:
outRl-ResourceLocationto get the input stream for.context-ResourceGenerationContextcontaining 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:
getLocationsin interfacePathAwareInputStreamSource- Returns:
- the locations that this
InputStreamSourcecan 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:ResourceGeneratorCreate 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:
persistentCacheDatain interfaceResourceGenerator- Parameters:
ops- DynamicOps to encode the unique key with.location- the resource location that will be generatedcontext- 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
- Specified by:
codecin interfaceResourceGenerator- Returns:
- A codec that can serialize this resource generator.
-