Miner Arcana - Astral

Miner Arcana - Astral

737k Downloads

Astral has a few unregistered configuredfeatures

TelepathicGrunt opened this issue · 9 comments

commented

Hello! I was test running my mod called Blame with a bunch of mods and it seemed to have found that Astral has a few ConfiguredFeatures that are 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:
image

Specifically, when you call .withConfiguration on a Feature, you create a ConfiguredFeature. This is what should be registered to the WorldgenRegisties at mod init (you can do it in FMLCommonSetupEvent so you have your config ready too if it is needed).

Anyway here's an example from my mod RepurposedStructures of me registering all my ConfiguredFeatures.
https://github.com/TelepathicGrunt/RepurposedStructures/blob/584433a0745338802c84e9f498dc063c1f5505f8/src/main/java/com/telepathicgrunt/repurposedstructures/modinit/RSConfiguredStructures.java#L72-L74

I hope this helps!

From the log with Blame:
astral:etheric_isle
astral:feverweed
astral:snowberries

commented

Investigating it

commented

This commit should fix it. Is this what you meant by static initialization @TelepathicGrunt?

commented

Try this version and let me know if it is still triggering blame @febilian
https://www.curseforge.com/minecraft/mc-mods/ma-astral/files/3459928

commented

That version fixed the issue now. I'll close this report!

commented

Just so you know, this mod appears to still be triggering Blame reports in version 1.9.17, namely for the etheric isle and snowberries.

https://gist.github.com/Febilian/73e6fae820a9113d5dd5422e641ca5ee

https://gist.github.com/Febilian/d8ae565c59738ae0fa6f85421837547d

commented

I'm registering configured features here. Am I doing something incorrectly?

Registry.register(featureRegistry, new ResourceLocation(Astral.MOD_ID, "feverweed"), CONFIGURED_FEVERWEED.get());

commented

public static final Supplier<ConfiguredFeature<?, ?>> CONFIGURED_ETHEREAL_TREE = () -> AstralFeatures.ETHEREAL_TREE.get().withConfiguration(EtherealTree.ETHEREAL_TREE_CONFIG.get()).square();

ok so funny story. I had a friend who was registering configuredfeatures or at least was trying to. But no matter what, it kept triggering blame. So I cloned his project and dug keep to even comparing the object's very own internal IDs to see instances and all.

what I found was, doing () -> thing actually makes a new instance every time you call .get(). And this makes sense too and I should've seen this from the start lol. () -> basically means run the following code which is your code to make a new configuredfeature. not return an existing one. That's why it confused me and my friend for so long until I was actually looking directly at the object instances and saw new instances being created before my very eyes.

It's a nasty bug lol. I would recommend sticking with static init for configuredfeatures as they are safe for that or you could try and utilize a different supplier that would only make the object once and return that instance. RegistryObject might work but idk how tied it is to forge registries and stuff

commented

Would switching to a NonNullLazy fix the issue? I'll release a beta once I fix a few more bugs.

commented

I’m not sure. You can try making a build and then test it with blame. It’ll print to the logs if it find unregistered ConfiguredFeatures when you load into a world so that’s a good way to check if it worked