Record Class DatapackRegistryGathererImpl
- Record Components:
global- The gather of the global registry set,nullif this is the global registry set.id- The id of the gatherer, either 'Global' for the global registry set, or the mod id specifying the set of mod ids to generate for.builder- TheRegistrySetBuilders to register the datapack registry objects to, depending on their registry's layer.modIds- The set of mod ids to generate the registry elements of.hasEntries- A helper for keeping track of whether any entries were registered to theRegistrySetBuilders.
- All Implemented Interfaces:
DatapackRegistryGatherer
DatapackRegistryGatherer.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DatapackRegistrySets<RegistrySetBuilder> The field for thebuilderrecord component.private final @Nullable DatapackRegistryGathererThe field for theglobalrecord component.private final DatapackRegistrySets<org.apache.commons.lang3.mutable.MutableBoolean> The field for thehasEntriesrecord component.private final StringThe field for theidrecord component.The field for themodIdsrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionDatapackRegistryGathererImpl(Set<String> modIds) Used to construct the global registry gatherer.DatapackRegistryGathererImpl(@Nullable DatapackRegistryGatherer global, String id, DatapackRegistrySets<RegistrySetBuilder> builder, Set<String> modIds, DatapackRegistrySets<org.apache.commons.lang3.mutable.MutableBoolean> hasEntries) Creates an instance of aDatapackRegistryGathererImplrecord class.DatapackRegistryGathererImpl(DatapackRegistryGatherer global, String id, Set<String> modIds) Used to construct the registry gatherer for a subset of mod ids. -
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.builder()Returns the value of thebuilderrecord component.(package private) DatapackRegistrySets<CompletableFuture<HolderLookup.Provider>> createGlobal(CompletableFuture<HolderLookup.Provider> worldRegistries) An internal method used to create the global registry set used for generation.(package private) voidcreateSub(DataGenerator generator, DatapackRegistrySets<CompletableFuture<HolderLookup.Provider>> registrySets, int index) An internal method used to add the data providers for any mod id subset, if any entries were added.final booleanIndicates whether some other object is "equal to" this one.global()Returns the value of theglobalrecord component.DatapackRegistrySets<org.apache.commons.lang3.mutable.MutableBoolean> Returns the value of thehasEntriesrecord component.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.private static booleanisWorldOrDimensionRegistry(ResourceKey<? extends Registry<?>> registryKey) Returns whether the providedResourceKeybelongs to a datapack registry in the dimension or world layer.modIds()Returns the value of themodIdsrecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from interface DatapackRegistryGatherer
advancement, lootTable, recipe
-
Field Details
-
global
The field for theglobalrecord component. -
id
-
builder
The field for thebuilderrecord component. -
modIds
-
hasEntries
The field for thehasEntriesrecord component.
-
-
Constructor Details
-
DatapackRegistryGathererImpl
DatapackRegistryGathererImpl(DatapackRegistryGatherer global, String id, Set<String> modIds) Used to construct the registry gatherer for a subset of mod ids.- Parameters:
global- The global registry gatherer.id- The mod id specifying the subset of mod ids to generate for.modIds- The set of mod ids to generate the registry elements of.
-
DatapackRegistryGathererImpl
-
DatapackRegistryGathererImpl
DatapackRegistryGathererImpl(@Nullable DatapackRegistryGatherer global, String id, DatapackRegistrySets<RegistrySetBuilder> builder, Set<String> modIds, DatapackRegistrySets<org.apache.commons.lang3.mutable.MutableBoolean> hasEntries) Creates an instance of aDatapackRegistryGathererImplrecord class.- Parameters:
global- the value for theglobalrecord componentid- the value for theidrecord componentbuilder- the value for thebuilderrecord componentmodIds- the value for themodIdsrecord componenthasEntries- the value for thehasEntriesrecord component
-
-
Method Details
-
add
public <T> DatapackRegistryGatherer add(ResourceKey<? extends Registry<T>> registryKey, SingleRegistryBootstrap<T> bootstrap) throws IllegalArgumentException Description copied from interface:DatapackRegistryGathererAdds 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.- Specified by:
addin interfaceDatapackRegistryGatherer- 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
public DatapackRegistryGatherer add(MultiRegistryBootstrap bootstrap) throws IllegalArgumentException Description copied from interface:DatapackRegistryGathererAdds 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.- Specified by:
addin interfaceDatapackRegistryGatherer- 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.
-
isWorldOrDimensionRegistry
Returns whether the providedResourceKeybelongs to a datapack registry in the dimension or world layer.- Parameters:
registryKey- TheResourceKeyof the registry to check.- Returns:
- whether the provided
ResourceKeybelongs to a datapack registry in the dimension or world layer
-
createGlobal
DatapackRegistrySets<CompletableFuture<HolderLookup.Provider>> createGlobal(CompletableFuture<HolderLookup.Provider> worldRegistries) An internal method used to create the global registry set used for generation.- Parameters:
worldRegistries- The vanilla world registries.- Returns:
- The registry set containing the modded registries for each layer.
-
createSub
void createSub(DataGenerator generator, DatapackRegistrySets<CompletableFuture<HolderLookup.Provider>> registrySets, int index) An internal method used to add the data providers for any mod id subset, if any entries were added.- Parameters:
generator- The data generator.registrySets- The global registries for each layer.index- A unique identifier to prevent name collisions.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
global
-
id
-
builder
-
modIds
-
hasEntries
Returns the value of thehasEntriesrecord component.- Returns:
- the value of the
hasEntriesrecord component
-