SpongePowered / Mixin

Mixin is a trait/mixin and bytecode weaving framework for Java using ASM
MIT License
1.41k stars 194 forks source link

Cannot find target for @Shadow field #641

Closed AlgorithmLX closed 1 year ago

AlgorithmLX commented 1 year ago

Hello! I have a problem with creating a mixin.

My Mixin Class:

@Mixin(SystemToast.Type.class)
@Unique
public class TypeMixin {
    @Shadow
    @Final
    @Mutable
    private static SystemToast.Type[] $VALUES;

    private static final SystemToast.Type TEST_TOAST = biscuitstory$addValue("TEST_TOAST");

    @Invoker("<init>")
    public static SystemToast.Type biscuit$invokeInit(String par1, int par2) {
        throw new AssertionError();
    }

    private static SystemToast.Type biscuit$addValue(String enid) {
        ArrayList<SystemToast.Type> storyvalues = new ArrayList<>(Arrays.asList(TypeMixin.$VALUES));
        SystemToast.Type toastType = biscuit$invokeInit(enid, storyvalues.get(storyvalues.size() -1).ordinal() + 1);
        storyvalues.add(toastType);
        TypeMixin.$VALUES = storyvalues.toArray(new SystemToast.Type[0]);
        return toastType;
    }
}

Warning in gradle: warning: Cannot find target for @Shadow field in net.minecraft.client.gui.toasts.SystemToast$Type What should I do?

Mumfrey commented 1 year ago

Hi. This is an issue tracker, please use discord for support questions.