lundi 27 mars 2017

Looking for the class of an Iterable to create a constructor using reflection

Good day,

I've got a question regarding reflection in Java. I want to instanciate a constructor for a class PacketPlayOutPlayerInfo using the following constructor:

public PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction paramEnumPlayerInfoAction, Iterable<EntityPlayer> paramIterable){
    [...]
}

To build the constructor i use this method

Constructor<?> packetPlayerInfoConstructor = ReflectionHandler.getNMSClass("PacketPlayOutPlayerInfo").getConstructor(
                                ReflectionHandler.getNMSClass("PacketPlayOutPlayerInfo$EnumPlayerInfoAction"), _____);

The first argument is working perfectly fine, but I somehow have to get the class of the interface Iterable to get the constructor to work... (or do I?)

Thanks in advance and have a nice day,

rapt0r





Aucun commentaire:

Enregistrer un commentaire