Roots

Roots

24M Downloads

Crash between Roots and Pollution of the Realms 1.12.2

EverSoul opened this issue ยท 3 comments

commented

I was walking around the world and my game crash. Vanilla fix says its an issue between Roots and Pollution of the Realms.

Crash report:
https://paste.dimdev.org/toxudoyiji.mccrash

commented

This error occurs when a mod adds an additional PlantType.

Because PlantType is a Java "enum", which is meant to be unmodifiable, certain things have to take place behind the scenes in order to add new entries. It is entirely safe to add new entries, and Forge provides specific methods to do so.

However, any time a request to get the values of the PlantType enum takes place, the values are set in stone. If the modification happens to take place after the values have been requested, then the modification isn't effective. This means that, while the code will properly look for 17 different PlantTypes, it will actually only find 16 (because it was "locked" in place by some other code).

Thus, this is a combination of:

a) A mod adds a PlantType
b) Another mod queries PlantTypes before or at the same time as a) takes place.
c) Another mod, at a much later point, loops over PlantTypes but suffers a crash because there are actually only 16 values, but 17 are being reported.

Thankfully, despite this being quite complex, the cause is quite simple: the PlantType addition needs to take place as soon and as early as possible, before anything else.

This means that PlantType enum creations need to be done a) statically, and b) in the first possible file (generally the main mod file, when it's loaded by Forge).

Generally this means:

@Mod(etc)
public class MyMod {
    public static PlantType MyCustomPlant = EnumHelper.addPlantType(...);
}

Alternately, it is possible that some other mod is accessing the values of the PlantType enum statically and is causing the issue, but that is highly unlikely.

In summary: Roots is just happening to be looking at the PlantType values and experiencing a crash because of some other code. If it is indeed Pollution of the Realms, then they need to change their code to make sure that their custom PlantType is being registered as early as possible.

If it is something else, you may need to dig a little, I'm afraid. :(

commented

Thank you for the quick reply. I will report it to their end as well.

commented

It may also be another mod in your pack and VanillaFix is just confused.