Class TagSupplier.TagBakery
java.lang.Object
dev.lukebemish.dynamicassetgenerator.api.sources.TagSupplier.TagBakery
- All Implemented Interfaces:
InputStreamSource,PathAwareInputStreamSource,Resettable,TagSupplier,Function<ResourceGenerationContext,Map<net.minecraft.resources.ResourceLocation, Set<net.minecraft.resources.ResourceLocation>>>
- Enclosing interface:
TagSupplier
public static class TagSupplier.TagBakery
extends Object
implements PathAwareInputStreamSource, Resettable, TagSupplier
A utility for easily providing any number of tags to a resource cache.
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.lukebemish.dynamicassetgenerator.api.sources.TagSupplier
TagSupplier.TagBakery -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply(ResourceGenerationContext context) @Nullable StringcreateCacheKey(net.minecraft.resources.ResourceLocation outRl, ResourceGenerationContext context) Create a key that can be uniquely used to identify the resource this generator will generate.@Nullable StringcreateSupplierCacheKey(net.minecraft.resources.ResourceLocation outRl, ResourceGenerationContext context) Create a key that can be uniquely used to identify the tag map to be generated.@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.@NonNull Set<net.minecraft.resources.ResourceLocation> getLocations(ResourceGenerationContext context) voidqueue(TagSupplier tagSupplier) Queues an unresolved set of tags to be added when this source is resolved.voidqueue(Map<net.minecraft.resources.ResourceLocation, Set<net.minecraft.resources.ResourceLocation>> tags) Queues a set of tags to be added when this source is resolved.voidqueue(net.minecraft.resources.ResourceLocation tag, Set<net.minecraft.resources.ResourceLocation> entries) Queues the provided entries to be added to the provided tag when this source is resolved.voidqueue(net.minecraft.resources.ResourceLocation tag, net.minecraft.resources.ResourceLocation entry) Queues a single entry to be added to a tag when this source is resolvedvoidreset(ResourceGenerationContext context) Resets some state associated with sources registered to the resource cache.
-
Constructor Details
-
TagBakery
public TagBakery()
-
-
Method Details
-
queue
Queues an unresolved set of tags to be added when this source is resolved.- Parameters:
tagSupplier- supplies a map of tag identifiers to sets of registry entry identifiers
-
queue
public void queue(net.minecraft.resources.ResourceLocation tag, Set<net.minecraft.resources.ResourceLocation> entries) Queues the provided entries to be added to the provided tag when this source is resolved.- Parameters:
tag- the identifier of the tag to be queuedentries- the identifiers of the registry entries to be added to the tag
-
queue
public void queue(net.minecraft.resources.ResourceLocation tag, net.minecraft.resources.ResourceLocation entry) Queues a single entry to be added to a tag when this source is resolved- Parameters:
tag- the identifier of tag to add an entry toentry- the identifier of the entry to add
-
queue
public void queue(Map<net.minecraft.resources.ResourceLocation, Set<net.minecraft.resources.ResourceLocation>> tags) Queues a set of tags to be added when this source is resolved.- Parameters:
tags- a map of tag identifiers to sets of registry entry identifiers
-
get
public @Nullable 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.
-
reset
Description copied from interface:ResettableResets some state associated with sources registered to the resource cache.- Specified by:
resetin interfaceResettable- Specified by:
resetin interfaceTagSupplier
-
apply
public Map<net.minecraft.resources.ResourceLocation,Set<net.minecraft.resources.ResourceLocation>> apply(ResourceGenerationContext context) - Specified by:
applyin interfaceFunction<ResourceGenerationContext,Map<net.minecraft.resources.ResourceLocation, Set<net.minecraft.resources.ResourceLocation>>>
-
createCacheKey
public @Nullable String createCacheKey(net.minecraft.resources.ResourceLocation outRl, ResourceGenerationContext context) Description copied from interface:InputStreamSourceCreate 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:
createCacheKeyin interfaceInputStreamSource- Parameters:
outRl- 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
-
createSupplierCacheKey
public @Nullable String createSupplierCacheKey(net.minecraft.resources.ResourceLocation outRl, ResourceGenerationContext context) Description copied from interface:TagSupplierCreate a key that can be uniquely used to identify the tag map to be generated. 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:
createSupplierCacheKeyin interfaceTagSupplier- Parameters:
outRl- 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
-