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; } }
@Override public void init() { if (FMLCommonHandler.instance().getSide().isServer()) return; try { Natura.logger.fine("[NEI] Registering Natura NEI plugin."); NEICompat.registerNEICompat(); } catch (Exception e) { e.printStackTrace(); } }