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;
|
||||
|
@ -64,11 +65,13 @@ public class EventBus
|
|||
private void register(Class<?> eventType, Object target, Method method)
|
||||
{
|
||||
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);
|
||||
|
||||
|
||||
ArrayList<IEventListener> others = listeners.get(target);
|
||||
if (others == null)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue