Fix potential issue with custom events where the constructor is not visible from the EventBus class, Should never arise but meh.
This commit is contained in:
parent
aeebb6e9f9
commit
de47895e02
1 changed files with 6 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
|||
package net.minecraftforge.event;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
|
@ -65,7 +66,9 @@ public class EventBus
|
|||
{
|
||||
try
|
||||
{
|
||||
Event event = (Event)eventType.newInstance();
|
||||
Constructor<?> ctr = eventType.getConstructor();
|
||||
ctr.setAccessible(true);
|
||||
Event event = (Event)ctr.newInstance();
|
||||
ASMEventHandler listener = new ASMEventHandler(target, method);
|
||||
event.getListenerList().register(busID, listener.getPriority(), listener);
|
||||
|
||||
|
|
Loading…
Reference in a new issue