Ejemplo n.º 1
0
 Object createGuiElement(Class cls, EntityPlayer player, World world, int x, int y, int z) {
   try {
     try {
       if (debugGui)
         System.out.printf(
             "BaseMod.createGuiElement: Invoking create method of %s for %s in %s\n",
             cls, player, world);
       return cls.getMethod(
               "create", EntityPlayer.class, World.class, int.class, int.class, int.class)
           .invoke(null, player, world, x, y, z);
     } catch (NoSuchMethodException e) {
       if (debugGui)
         System.out.printf("BaseMod.createGuiElement: Invoking constructor of %s\n", cls);
       return cls.getConstructor(EntityPlayer.class, World.class, int.class, int.class, int.class)
           .newInstance(player, world, x, y, z);
     }
   } catch (Exception e) {
     Throwable cause = e.getCause();
     System.out.printf("BaseMod.createGuiElement: %s: %s\n", e, cause);
     if (cause != null) cause.printStackTrace();
     else e.printStackTrace();
     // throw new RuntimeException(e);
     return null;
   }
 }
Ejemplo n.º 2
0
 public static boolean explodeMachineAt(World world, int x, int y, int z) {
   try {
     Class<?> mainIC2Class = Class.forName("ic2.common.IC2");
     mainIC2Class
         .getMethod("explodeMachineAt", World.class, Integer.TYPE, Integer.TYPE, Integer.TYPE)
         .invoke(null, world, x, y, z);
     return true;
   } catch (Exception e) {
     System.out.printf("GregsLighting.explodeMachineAt: %s\n", e);
     return false;
   }
 }