Fabric API

Fabric API

152M Downloads

[1.21.5] Adding a configured feature to registry is impossible?

Slava0135 opened this issue ยท 9 comments

commented

Tutoral at https://wiki.fabricmc.net/tutorial:features is outdated (BuiltinRegistries.CONFIGURED_FEATURE doesn't exist now):

@Override
    public void onInitialize() {
        Registry.register(Registry.FEATURE, EXAMPLE_FEATURE_ID, EXAMPLE_FEATURE);
        Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, EXAMPLE_FEATURE_ID, EXAMPLE_FEATURE_CONFIGURED); // The last line has to be updated
    }

I tried to get dynamic registry (in main ModInitializer):

var registry = BuiltinRegistries.createWrapperLookup().getEntryOrThrow(RegistryKeys.CONFIGURED_FEATURE).value();

But it is not found (I tried to do this on SERVER_STARTING and SERVER_STARTED events too, because features are loaded per world, unless I got it wrong).

Are mixins the only option here?

(Disclaimer: i am very new to Minecraft modding)

commented

The wiki is community maintained and is frequently out of date. The recommend way to manage features now is through datagen. I seem to recall an example gist I've found... Wil report back in a few minutes

commented

This gist should have examples on features, courtesy of Linguardium https://gist.github.com/Linguardium/b81e85b3541429bbd3ca63a93b24485f

commented

I really should make an index so I don't have to search every time

commented

This gist should have examples on features, courtesy of Linguardium https://gist.github.com/Linguardium/b81e85b3541429bbd3ca63a93b24485f

Thanks, should someone update the wiki page?

commented

Thanks, should someone update the wiki page?

Maybe? I feel like this is something that should probably be moved to the official documentation, if it isn't already

commented

This gist should have examples on features, courtesy of Linguardium https://gist.github.com/Linguardium/b81e85b3541429bbd3ca63a93b24485f

This seems to work, thanks again.