FerriteCore ((Neo)Forge)

FerriteCore ((Neo)Forge)

96M Downloads

Crash with Friends&Foes

Faboslav opened this issue ยท 4 comments

commented

When i run project with my mod Friends&Foes, game wont start, but i cant tell what is wrong. I tried to remove all new mixins opposite to my prev version of the mod, but i did not have any success with that.

crash-2022-01-17_09.34.09-client.txt.

commented

Okay after more investigation crash occurs if i am using EarlyRiser using Fabric-ASM:

import com.chocohead.mm.api.ClassTinkerers;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.MappingResolver;

public class EarlyRiser implements Runnable
{
	@Override
	public void run() {
		if (FriendsAndFoes.CONFIG.enableIllusionerInRaids) {
			MappingResolver remapper = FabricLoader.getInstance().getMappingResolver();

			String Raid = remapper.mapClassName("intermediary", "net.minecraft.class_3765$class_3766");
			String EntityType = 'L' + remapper.mapClassName("intermediary", "net.minecraft.class_1299") + ';';

			ClassTinkerers
				.enumBuilder(Raid, EntityType, int[].class)
				.addEnum("ILLUSIONER", () -> new Object[]{net.minecraft.entity.EntityType.ILLUSIONER, new int[]{0, 0, 0, 0, 0, 0, 1, 1}})
				.build();
		}
	}
}

Is there anything tan can be done differently to prevent this crash? Because lot a of modpack does have your mod and my mod Friends&Foes as well and i would like to release this update :).

commented

From here:

The earliness that extensions require poses potential pitfalls from class loading. Given the main launch class will get to be resolved, any accidental reference to a class that might have Mixins that need to be applied will certainly result in a sad time. As a consequence there's a great need to be careful the for classes that might be loaded by an Early Riser.

In particular, you are loading the class FriendsAndFoes, which in turn loads OmegaConfig, which loads Identifier aka class_1091. I have an accessor Mixin into Identifier/ResourceLocation, so the result is what Chocohead refers to as "a sad time".

commented

So is there any solution for that, maybe i dont load the class FriendsAndFoes?

commented

Anyway thank you very much for the explanation!