mardi 2 février 2021

object is not an instance of declaring class java minecraft

I am making a minecraft PVP client and when using the reflect method I keep getting this error:

java.lang.IllegalArgumentException: object is not an instance of declaring class
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at Val.events.Event.call(Event.java:14)
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:2265)
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1112)
    at net.minecraft.client.Minecraft.run(Minecraft.java:416)
    at net.minecraft.client.main.Main.main(Main.java:114)
    at Start.main(Start.java:11)

Event.java

package Val.events;

import java.util.ArrayList;

public class Event {
    
    public Event call() {
        
        final ArrayList<EventData> dataList = EventManager.get(this.getClass());
        
        if(dataList != null) {
            for(EventData data : dataList) {
                try {
                    data.target.invoke(dataList, this);
                } catch(Exception e) {
                    e.printStackTrace();
                }
            }
        }
        return null;
        
    }

}

I've looked at the reflect method class but it seems fine to me.

Thank you for you're help.





Aucun commentaire:

Enregistrer un commentaire