[FAPI 0.68.0] `FabricDataGenHelper.createRegistryWrapper` changes bootstrap order.
See original GitHub issueI am trying to use the DataGen to create all relevant files for my Biomes and Features by adding custom bootstrap methods to the buildRegistry
entry point:
@Override
public void buildRegistry(RegistrySetBuilder registryBuilder) {
registryBuilder.add(Registries.CONFIGURED_FEATURE, TestConfiguredFeatures::bootstrap);
registryBuilder.add(Registries.PLACED_FEATURE, TestPlacedFeatures::bootstrap);
registryBuilder.add(Registries.BIOME, TestBiomes::bootstrap);
registryBuilder.add(Registries.NOISE_SETTINGS, NoiseDatagen::bootstrap);
}
The PLACED_FEATURE-Bootstrap relies on objects created in the CONFIGURED_FEATURE-bootstrap, and BIOMEs rely on the PLACED_FEATUREs.
If the bootstrap for those Biomes is called before the features are initialised, there may be odd behaviour.
Unfortunately, FabricDataGenHelper.createRegistryWrapper
does not run toe bootstrap sequence in the same order as BuiltinRegistries.REGISTRY_BUILDER
. This is due to the use of an unordered value-set of a HasMap that will populate the RegistryBuilder
:
https://github.com/FabricMC/fabric/blob/70063eb9397d2a82209d3c048881952ab3cae94d/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/impl/datagen/FabricDataGenHelper.java#L180
https://github.com/FabricMC/fabric/blob/70063eb9397d2a82209d3c048881952ab3cae94d/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/impl/datagen/FabricDataGenHelper.java#L192-L194
I think the new RegistryBuilder
should retain the original order that is used in BuiltinRegistries.REGISTRY_BUILDER
for all vanilla Registries.
Issue Analytics
- State:
- Created 10 months ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
I believe this is working as intenteded using the
RegistryEntry.Reference
is the expected way of doing this. If you do have a use case where this doesnt work for please let me know.Maybe I should also show how we use those Methods This is a simplified Version of what is actually going on in our Code:
So when bootstrapping
PlacedFeature
,FEATURE_A
would wither be an unboundReference
or a boundRegistryEntry
. We can use both to create thePlacedFeature
s.Whenever the bootstrap process of
ConfiguredFeature
s runs, it will take the information that is already stored in theRegistryEntry
(remeber our Version of the Reference holds both the key and the value) to register those with the Registry.