itzer Posted December 20, 2023 Posted December 20, 2023 I'm updating my mod from 1.19.2 to 1.20.X, going to 1.19.3 as an intermediate step so that I can ensure my data generators work correctly before updating the rest. I have many lines to create configured features that look like this: ALPINE_ROCK = new ConfiguredFeature<>(ModGeneration.OUTCROP.get(), new BlockStateConfiguration(Blocks.STONE.defaultBlockState())); Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, new ResourceLocation(Main.MOD_ID, "alpine_rock"), ALPINE_ROCK); Now I am on 1.19.3, BuiltinRegistries.CONFIGURED_FEATURE no longer exists. What is the proper way to register configured features in this version? Can this even still be done in code, or is this one of the "dynamic registries" affected by the registry overhaul? If it can no longer be done in code, what is necessary to do it using JSON? Quote
InvictusSlayer Posted December 21, 2023 Posted December 21, 2023 It is now done with datagen, you will need to add a `DatapackBuiltinEntriesProvider` to your data generator. The `RegistrySetBuilder` argument should look something like this: private static final RegistrySetBuilder BUILDER = new RegistrySetBuilder() .add(Registries.CONFIGURED_FEATURE, ModConfiguredFeatures::bootstrap) .add(Registries.PLACED_FEATURE, ModPlacedFeatures::bootstrap); with your `ModConfiguredFeatures` class based on this rough template: public static final ResourceKey<ConfiguredFeature<?, ?>> EXAMPLE = createKey("example"); // Add more keys here public static void bootstrap(BootstapContext<ConfiguredFeature<?, ?>> context) { HolderGetter<ConfiguredFeature<?, ?>> configured = context.lookup(Registries.CONFIGURED_FEATURE); HolderGetter<PlacedFeature> placed = context.lookup(Registries.PLACED_FEATURE); register(context, EXAMPLE, Feature.EXAMPLE_FEATURE, new ExampleConfiguration(args)); // Register more features here } private static ResourceKey<ConfiguredFeature<?, ?>> createKey(String name) { return ResourceKey.create(Registries.CONFIGURED_FEATURE, new ResourceLocation("modid", name)); } private static <FC extends FeatureConfiguration, F extends Feature<FC>> void register(BootstapContext<ConfiguredFeature<?, ?>> context, ResourceKey<ConfiguredFeature<?, ?>> key, F feature, FC config) { context.register(key, new ConfiguredFeature<>(feature, config)); } Hope this helps get you started 1 Quote
Hankinsohl Posted February 24 Posted February 24 (edited) x Edited February 24 by Hankinsohl Posted by mistake Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.