Interface DatapackRegistryGatherer
- All Known Subinterfaces:
GlobalDatapackRegistryGatherer
- All Known Implementing Classes:
DatapackRegistryGathererImpl, GatherDataRegistryEntriesEvent
Gathers the datapack registry entries during GatherDataRegistryEntriesEvent. Only mods added via '--mod'
in the run arguments generate their contents, but all gathered entries can still be used for other parts of
the data generation pipeline.
Distinctions between the different registry layers (i.e., world, reloadable) are abstracted away and handled by the implementation.
-
Method Summary
Modifier and TypeMethodDescriptionadd(MultiRegistryBootstrap bootstrap) Adds a bootstrap for the requested registries to register entries for use during data generation.add(ResourceKey<? extends Registry<T>> registryKey, SingleRegistryBootstrap<T> bootstrap) Adds a bootstrap for the provided registryResourceKeyto register entries for use during data generation.default DatapackRegistryGathereradvancement(AdvancementSubProvider.Factory subProvider, AdvancementSubProvider.Factory... subProviders) Adds the sub providers used to bootstrap theRegistries.ADVANCEMENTentries for use during data generation.private static <T> List<T> createList(T first, T... elements) An internal helper for converting a single element followed by a varargs of elements into a list.default DatapackRegistryGathererlootTable(LootTableProvider.SubProviderEntry subProvider, LootTableProvider.SubProviderEntry... subProviders) Adds the sub providers used to bootstrap theRegistries.LOOT_TABLEentries for use during data generation.default DatapackRegistryGathererrecipe(BiFunction<BootstrapContext<Recipe<?>>, BootstrapContext<Advancement>, ? extends RecipeProvider> providerFactory) Adds the recipe provider used to bootstrap theRegistries.RECIPEentries for use during data generation.
-
Method Details
-
add
<T> DatapackRegistryGatherer add(ResourceKey<? extends Registry<T>> registryKey, SingleRegistryBootstrap<T> bootstrap) throws IllegalArgumentException Adds a bootstrap for the provided registry
ResourceKeyto register entries for use during data generation. The layer each registry belongs to is handled internally.Analogous to
RegistrySetBuilder.add(ResourceKey, SingleRegistryBootstrap).Custom datapack registries must be registered via
NewDatapackRegistryEventfirst; otherwise, an exception will be thrown.- Type Parameters:
T- The type of the registry object.- Parameters:
registryKey- The key of the registry.bootstrap- The bootstrap used to register entries to the registry.- Returns:
- This gatherer.
- Throws:
IllegalArgumentException- If theregistryKeydoes not belong to a datapack registry.
-
add
Adds a bootstrap for the requested registries to register entries for use during data generation. The layer the registries belong to is handled internally.
Analogous to
RegistrySetBuilder.add(MultiRegistryBootstrap).Custom datapack registries must be registered via
NewDatapackRegistryEventfirst. Additionally, all requested registries must be part of the same registry layer. Otherwise, an exception will be thrown.- Parameters:
bootstrap- The bootstrap used to register entries to the requested registries.- Returns:
- This gatherer.
- Throws:
IllegalArgumentException- If not all requested registries are datapack registries in the same layer.
-
lootTable
default DatapackRegistryGatherer lootTable(LootTableProvider.SubProviderEntry subProvider, LootTableProvider.SubProviderEntry... subProviders) Adds the sub providers used to bootstrap theRegistries.LOOT_TABLEentries for use during data generation. Wraps aroundLootTableProvider.- Parameters:
subProvider- The sub provider used to add loot tables for a specific loot context parameter set.subProviders- Any additional sub providers.- Returns:
- This gatherer.
-
advancement
default DatapackRegistryGatherer advancement(AdvancementSubProvider.Factory subProvider, AdvancementSubProvider.Factory... subProviders) Adds the sub providers used to bootstrap theRegistries.ADVANCEMENTentries for use during data generation. Wraps aroundAdvancementProvider.- Parameters:
subProvider- The sub provider used to add advancements.subProviders- Any additional sub providers.- Returns:
- This gatherer.
-
recipe
default DatapackRegistryGatherer recipe(BiFunction<BootstrapContext<Recipe<?>>, BootstrapContext<Advancement>, ? extends RecipeProvider> providerFactory) Adds the recipe provider used to bootstrap theRegistries.RECIPEentries for use during data generation. Wraps aroundRecipeProvider.asBootstrap(BiFunction).- Parameters:
providerFactory- A bi-function that takes in theBootstrapContextfor the recipe and advancement registries to construct theRecipeProvider.- Returns:
- This gatherer.
-
createList
An internal helper for converting a single element followed by a varargs of elements into a list.- Type Parameters:
T- The type of the elements in the list.- Parameters:
first- The first element.elements- Any additional elements.- Returns:
- An unmodifiable list of elements.
-