[1.16.3] Voice Trumpet Feature's configuredfeature form is not registered
TelepathicGrunt opened this issue ยท 1 comments
Hello! I was testing out Teletubbies Mod with my own and had found that the ConfiguredFeature form of the Voice Trumpet is not registered. This can be an issue for mod compatibility as under certain conditions, unregistered ConfiguredFeatures can basically prevent other mod's registered ConfiguredFeatures from spawning if in the same generation stage.
By that I mean, if mod A adds an unregistered CF to the ore generation stage and the biome's codec reaches it first, it will choke and basically nuke mob B's registered CFs afterwards. Here's a case where BetterCaves forgot to register their CF and caused several CFs from Oh The Biomes You'll Go to stop spawning in the world: YUNG-GANG/YUNGs-Better-Caves#75
Here's a more detailed explanation of why this happens in the biome's codec:
Specifically, when you call .withConfiguration on a Feature, you create a ConfiguredFeature. This is what should be registered to the WorldgenRegisties.
All you need to do is replace this line
with the following code
ConfiguredFeature<?, ?> VOICE_TRUMPET_CONFIGURED_FEATURE = VOICE_TRUMPET_FEATURE.withConfiguration(new NoFeatureConfig()).withPlacement(Placement.FOREST_ROCK.configure(new FrequencyConfig(WorldGenConfig.VOICE_TRUMPET_FREQUENCY.get())));
Registry<ConfiguredFeature<?, ?>> registry = WorldGenRegistries.CONFIGURED_FEATURE;
Registry.register(registry, new ResourceLocation(Teletubbies.MODID, "voice_trumpet_configured_feature"), VOICE_TRUMPET_CONFIGURED_FEATURE);
addFeature(Decoration.SURFACE_STRUCTURES, VOICE_TRUMPET_CONFIGURED_FEATURE, Biomes.PLAINS, Biomes.SUNFLOWER_PLAINS);
That should work! And here's an example from my mod RepurposedStructures of me registering all my ConfiguredFeatures in case you plan on adding more and want to see one way of organizing everything.
https://github.com/TelepathicGrunt/RepurposedStructures/blob/a4e3365e3867b8510952ebf658c415de6e412927/src/main/java/com/telepathicgrunt/repurposedstructures/RSConfiguredFeatures.java#L184-L185
I hope this helps!