Fabric API

Fabric API

106M Downloads

[FAPI 0.86] RegistryLoaderMixin is overwriting Registry Path

quiqueck opened this issue ยท 5 comments

commented

This mixing is changing the path for every, non vanilla Registry. Even if a Registry is not managed with DynamicRegistries:

@Inject(method = "getPath", at = @At("RETURN"), cancellable = true)
private static void prependDirectoryWithNamespace(Identifier id, CallbackInfoReturnable<String> info) {
if (!id.getNamespace().equals(Identifier.DEFAULT_NAMESPACE)) {
String newPath = id.getNamespace() + "/" + info.getReturnValue();
info.setReturnValue(newPath);
}
}

The results in registries not getting loaded (quiqueck/BetterEnd#273)

commented

Hmmm, the problem here is that some mods were registering dynamic registries in non-API ways, and without prepending the path. We can indeed check if the dynamic registry was registered via FAPI for now.

commented

I am not 100% sure, but I think that FabricDynamicRegistryProvider is not using the changed paths to serialise the registry content:

final DataOutput.PathResolver pathResolver = output.getResolver(DataOutput.OutputType.DATA_PACK, registry.getValue().getPath());

I think it is just reading the unchanged Identifier-Path

commented

First off, I like the general idea of the change, and I was (obviously) not aware of a previous API to add custom, dynamic registries. But did that old API auto prefix the Mod Id, because if it does not, and the Registry was previously manually prefixed with the mod id, it would have two prefixes in the new version...

This is just my personal take on this, but as this change alters the registry paths between versions this is prone to cause soft fails (in our case, the surface rules are no longer loaded). It will also invalidate some data packs that did target our registries.

commented

I have created a PR to fix this, the current "broken" build is still marked as beta, and I expect to keep it this way.

commented

I agree, this should only make the change to registries created the API ๐Ÿ‘