Apotheosis

Apotheosis

79M Downloads

Apotheosis/Psipherals interaction nukes many mod's tags and can heavily break worldgen mods as a result

TelepathicGrunt opened this issue ยท 1 comments

commented

This started out with me trying to help a person with their modpack. They originally reached out to me because Minecraft was reporting my mod, Repurposed Structures, lost its configuredfeatures for its structures. Upon having the person put on Blame and show me the log, it exposed that everything was blowing up because Undergarden's tag ceased to exist in the modpack despite working perfectly fine in other modpacks. The errors found were the following:
image

And with the tag missing, the error cascades and breaks a large number of configuredfeatures and nukes them from the biomes too:
quek04/undergarden#92

TeamTwilight/twilightforest#1074

Now I seen this exact issue before. Specifically, with Immersive Engineering. I made a report to them and it turns out, the problem was they were classloading TagCollectionManager too early. It seems if a mod makes their tags solely in code and another mod classloads TagCollectionManager before the first mod can create the tag, TagCollectionManager doesn't get the tag and blows up anything that tries to use that tag. In this case, it is worldgen that blew up and the error cascaded everywhere and broke multiple mods too. This is not Undergarden's or Twilight Forest's issue as they are using the tags properly and expect said tag to exist in TagCollectionManager.
BluSunrize/ImmersiveEngineering#4642

Immersive Engineering resolved it by utilizing lazy for their tag system so that it does not classload it at mod startup:
BluSunrize/ImmersiveEngineering@6da174e

So I modified Blame to print out exactly when TagCollectionManager is classloaded. When done with just vanilla, it seem TagCollectionManager is called for the first time when creating or entering a world so it is done very late. However, with this unreleased version of Blame, it showed that Apotheosis called getRepairIngredient for Psipherals's material which then classloaded TagCollectionManager. And this is done in FMLCommonSetupEvent which is too early.
https://paste.ee/p/EsdO1

https://github.com/Dudblockman/Psipherals/blob/00b0c67771d6c4c514b718a512b663822960821c/src/main/java/com/dudblockman/psipherals/util/libs/AdvPsimetalToolMaterial.java#L36

This is tangently related to this issue report where the same code can also produce an ExceptionInInitializerError crash as well.
Dudblockman/Psipherals#6

This is also similar to the issue I had a while ago where if a person has The Bumblezone, Productive Bees, Apotheosis, and PSI all on together, my mod's tags will break and Blame will print and spam the logs with this:
https://hatebin.com/avdtwhhpvr

And this is also related to this as well:
vectorwing/FarmersDelight#106

I think it is getting close to say that the way Apotheosis handles loading anything that can use tags is dangerous and needs to be re-designed. Even just delaying it until the server startup event fires would prevent much of the crashes and worldgen issues I bet.

commented

Also, before anyone says that tags being used for game mechanics is bad, the truth is that is indeed what tags are for. If the game mechanic is only handled server-side, it makes it a perfect candidate for tags. In fact, Forge back on Jan 30 added a tag to change what blocks an Endermen can place blocks onto. This means that even Forge is copying Mojang's stance that tags can be used for game logic and mechanics. (Mojang uses tags in a lot of their blocks and worldgen features as well)

http://files.minecraftforge.net/maven/net/minecraftforge/forge/1.16.5-36.1.4/forge-1.16.5-36.1.4-changelog.txt
image