Dismantle DynamicRegistries#getDynamicRegistries into two more specific methods of DynamicRegistries#5377
Dismantle DynamicRegistries#getDynamicRegistries into two more specific methods of DynamicRegistries#5377FirstMegaGame4 wants to merge 11 commits into
Conversation
|
Looks like some of the datagen is having issues (see the check_resources job): Would it be possible to expand the tests somewhere to cover your usecase to ensure it doesnt regress in the future. |
|
After looking a bit more, calling dynamic registries pulled from Because a better name for them would be That's what was causing the data generation crash, since Thus, I had another idea: since my initial idea of having Does that seem right? |
|
First of all, fixes #3838 I understand that the separation between Dynamic Registries and Dimension Registries might seem strange and annoying, but this is a feature of the game, not a problem of FAPI. What I mean is, there's no need to significantly tweak the original game behavior, all we need is:
|
|
I agree that there is no need for further tweaking the original game behavior about the Level Stem registry. That's not a goal of the pull request here, it does not want nor does that. I agree about the documentation thing, specifying the difference between world registries and dimension registries is a need. (They do load after, they do not bootstrap by themselves, they are not patched.) Here, the pull request "only" changes the specification of Which silently solves the issue of the FabricDynamicRegistryProvider. |
|
After discussing this on Discord, we agreed that this PR cleans up the code much more than it seemed at first glance, |
|
By such, this PR will now put back the original behavior of |
Set DynamicRegistries#getWorldRegistries & DynamicRegistries#getBootstrappingRegistries Add very basic documentation about those two
|
Let's summarize what this PR does currently:
Let's then enumerate the internal changes for those:
Now, the last thing I'm wondering, is if
After all, it is a tool for modders, they might (why, idk) be using those. Edit: I suppose they can just use |
The only right solution would be to write the code for Mojang, which is a bad idea for many reasons. We shouldn't provide empty holders either, that's misleading. |
maityyy
left a comment
There was a problem hiding this comment.
The code looks good. But I'm still not sure about the idea itself, since we can't provide a Holder for vanilla entries (overworld, the_nether, the_end). In any case, NeoForge also allows you to generate a LevelStem using RegistrySetBuilder, so we can allow that too.
Let's give some context:I was dealing with FabricDynamicRegistryProvider in order to generate LevelStem json file objects. But the provider failed to retrieve them. That's something that logically should not happen, and modders are often making mixins to the FabricDynamicRegistryProvider class in order to allow it to load the LevelStem registry (which is a bad practice).After trying to understand why LevelStem entries were not retrieved, it seemed that it's becauseDynamicRegistries#getDynamicRegistrieswas specifically not giving theminecraft:dimensionregistry (registry for LevelStem objects).I felt wrong to me, asDynamicRegistries#getDynamicRegistriesshould, from my point of view, return the data of ALL dynamic registries (if we define "dynamic registries" as registries loaded from data packs, which is what I am assuming).After looking at the implementation, it seemed thatgetDynamicRegistrieswas pulling the registries fromRegistryDataLoader.WORLDGEN_REGISTRIES. It excludes theminecraft:dimensionregistry, as this one is part ofRegistryDataLoader.DIMENSION_REGISTRIES.After looking a bit further, it seemed thatWORLDGEN_REGISTRIESandDIMENSION_REGISTRIESdo not have the same use cases in the Minecraft code.- Firstly,DIMENSION_REGISTRIESare not data generated in vanilla. You can't find thedimensiondata directory in the game's jar.- Secondly, onlyWORLDGEN_REGISTRIESare being cloned inRegistryDataLoader#createLookup.- Thirdly,WORLDGEN_REGISTRIESare being loaded beforeDIMENSION_REGISTRIESinWorldLoader#load.So, these behaviors needs to be respected. Current registration of custom/fabric dynamic registries involve putting them in the same situation than the ones fromWORLDGEN_REGISTRIES.As such, to allow FabricDynamicRegistryProvider & other use cases to truly get every dynamic registries fromDynamicRegistries#getDynamicRegistries, this PR aims to allow this behavior, and to change the implementation of the registry module to only patchRegistryDataLoaderandWorldLoaderwith registries acting likeWORLDGEN_REGISTRIES, and not what should be "all dynamic registries".Other few questions:- Should Custom/Fabric Dynamic Registries be able to choose between the behavior ofWORLDGEN_REGISTRIESandDIMENSION_REGISTRIES?- Behavior ofWORLDGEN_REGISTRIESandDIMENSION_REGISTRIESinvolves a sort of "load order", should Fabric API provide a way for Custom/Fabric Dynamic Registries to set a "load order"/"load steps" between different registries?Check this comment.
Fixes #3838.