Class TextureReaderSource
java.lang.Object
dev.lukebemish.dynamicassetgenerator.api.client.generators.texsources.TextureReaderSource
- All Implemented Interfaces:
TexSource
A
TexSource that reads a texture from packs not provided by DynAssetGen.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<TextureReaderSource> Fields inherited from interface dev.lukebemish.dynamicassetgenerator.api.client.generators.TexSource
METADATA_CACHE_KEY -
Method Summary
Modifier and TypeMethodDescription@NonNull com.mojang.serialization.MapCodec<? extends TexSource> codec()net.minecraft.resources.ResourceLocationgetPath()net.minecraft.server.packs.resources.IoSupplier<com.mojang.blaze3d.platform.NativeImage> getSupplier(TexSourceDataHolder data, ResourceGenerationContext context) Provides a supplier for the texture this source will generate, or null if a texture cannot be provided.<T> @NonNull com.mojang.serialization.DataResult<T> persistentCacheData(com.mojang.serialization.DynamicOps<T> ops, ResourceGenerationContext context) If your texture source depends on loaded resources (anything stored in theResourceGenerationContext), you will need to override this method to return a unique key based on the actual, loaded resources.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.client.generators.TexSource
cacheMetadata, getCachedSupplier, stringify
-
Field Details
-
CODEC
-
-
Method Details
-
codec
-
getSupplier
public net.minecraft.server.packs.resources.IoSupplier<com.mojang.blaze3d.platform.NativeImage> getSupplier(TexSourceDataHolder data, ResourceGenerationContext context) Description copied from interface:TexSourceProvides a supplier for the texture this source will generate, or null if a texture cannot be provided. Should be overridden, but not called; callTexSource.getCachedSupplier(dev.lukebemish.dynamicassetgenerator.api.client.generators.TexSourceDataHolder, dev.lukebemish.dynamicassetgenerator.api.ResourceGenerationContext)instead to support caching.- Specified by:
getSupplierin interfaceTexSource- Parameters:
data- context information passed by outer nesting texture sources; if you depend on this, you will want to implement the caching API (seeTexSource.cacheMetadata(com.mojang.serialization.DynamicOps<T>, dev.lukebemish.dynamicassetgenerator.api.client.generators.TexSourceDataHolder))context- context about the environment the texture is generating in- Returns:
- a supplier able to produce the texture, or null if the texture could not be produced.
-
persistentCacheData
public <T> @NonNull com.mojang.serialization.DataResult<T> persistentCacheData(com.mojang.serialization.DynamicOps<T> ops, ResourceGenerationContext context) Description copied from interface:TexSourceIf your texture source depends on loaded resources (anything stored in theResourceGenerationContext), you will need to override this method to return a unique key based on the actual, loaded resources. This key will be used for caching across reloads, unlike that provided byTexSource.cacheMetadata(com.mojang.serialization.DynamicOps<T>, dev.lukebemish.dynamicassetgenerator.api.client.generators.TexSourceDataHolder). If your source should not be cached, return a DataResult.error.- Specified by:
persistentCacheDatain interfaceTexSource- Parameters:
ops- DynamicOps to encode the unique key with.context- the context that the resource will be generated in. Resources can safely be accessed in this context- Returns:
- A success with a unique key for the given context, or an error if no key can be generated.
-
getPath
public net.minecraft.resources.ResourceLocation getPath()
-