FabricMC/Mixin

MixinTargetAlreadyLoadedException is thrown regardless of the return value of shouldApplyMixin

ishland opened this issue · 1 comments

See ishland/EarlyLoadingScreen#1

It appears that Mixin is checking whether the class is loaded before calling shouldApplyMixin, causing this to happen:

for (Object target : this.readTargets(mixin)) {
DeclaredTarget declaredTarget = DeclaredTarget.of(target, this);
if (declaredTarget == null) {
continue;
}
if (tracker != null && tracker.isClassLoaded(declaredTarget.name) && !this.isReloading()) {
String message = String.format("Critical problem: %s target %s was loaded too early.", this, declaredTarget.name);
if (this.parent.isRequired()) {
throw new MixinTargetAlreadyLoadedException(this, message, declaredTarget.name);
}
this.logger.error(message);
}
if (this.shouldApplyMixin(ignorePlugin, declaredTarget.name)) {
declaredTargets.add(declaredTarget);
}
}

Early loading is a fairly critical problem anyway. Even if you don’t want to mix into that class someone else might want to. Nothing should ever be early loaded like that.