Пример #1
0
 public FallbackWrapper(ITrigger wrap) {
   try {
     iconMethod = wrap.getClass().getDeclaredMethod("getTextureIcon");
   } catch (Exception e) {
   }
   try {
     activeMethod =
         wrap.getClass()
             .getDeclaredMethod("isTriggerActive", TileEntity.class, ITriggerParameter.class);
   } catch (Exception e) {
     throw Throwables.propagate(e);
   }
   brokenInstance = wrap;
 }
Пример #2
0
 public static void fixTriggers() {
   if (fixedTriggers) return;
   for (int i = 0; i < ActionManager.triggers.length; i++) {
     try {
       ITrigger t = ActionManager.triggers[i];
       t = new FallbackWrapper(t);
       ActionManager.triggers[i] = t;
       BuildCraftCore.bcLog.severe(
           "Trigger " + t.getClass() + " using OLD API found, using a falling back wrapper!");
     } catch (RuntimeException e) {
       // Carry on
     }
   }
   fixedTriggers = true;
 }