Example #1
0
 @Subscribe
 public void handleModStateEvent(FMLEvent event) {
   if (!eventMethods.containsKey(event.getClass())) {
     return;
   }
   try {
     for (Method m : eventMethods.get(event.getClass())) {
       m.invoke(modInstance, event);
     }
   } catch (Throwable t) {
     controller.errorOccurred(this, t);
   }
 }
Example #2
0
 @Subscribe
 public void propogateStateMessage(FMLEvent stateEvent) {
   if (stateEvent instanceof FMLPreInitializationEvent) {
     modObjectList = buildModObjectList();
   }
   for (ModContainer mc : activeModList) {
     activeContainer = mc;
     String modId = mc.getModId();
     stateEvent.applyModContainer(activeContainer());
     FMLLog.log(
         modId, Level.FINEST, "Sending event %s to mod %s", stateEvent.getEventType(), modId);
     eventChannels.get(modId).post(stateEvent);
     FMLLog.log(modId, Level.FINEST, "Sent event %s to mod %s", stateEvent.getEventType(), modId);
     activeContainer = null;
     if (stateEvent instanceof FMLStateEvent) {
       if (!errors.containsKey(modId)) {
         modStates.put(modId, ((FMLStateEvent) stateEvent).getModState());
       } else {
         modStates.put(modId, ModState.ERRORED);
       }
     }
   }
 }
Example #3
0
 @Subscribe
 public void handleModStateEvent(FMLEvent event) {
   Class<? extends Annotation> annotation = modAnnotationTypes.get(event.getClass());
   if (annotation == null) {
     return;
   }
   try {
     for (Object o : annotations.get(annotation)) {
       Method m = (Method) o;
       m.invoke(modInstance, event);
     }
   } catch (Throwable t) {
     controller.errorOccurred(this, t);
     Throwables.propagateIfPossible(t);
   }
 }