コード例 #1
0
 /**
  * Tries to open a URL in the Browser
  *
  * @param url The URL
  * @param shiftUrl The URL to open when Shift is held
  */
 public static void openBrowser(String url, String shiftUrl) {
   try {
     if (Desktop.isDesktopSupported()) {
       if (shiftUrl.equals(url) || KeyUtil.isShiftPressed()) {
         Desktop.getDesktop().browse(new URI(shiftUrl));
       } else {
         Desktop.getDesktop().browse(new URI(url));
       }
     }
   } catch (Exception e) {
     ModUtil.LOGGER.error("Something bad happened when trying to open a URL!", e);
   }
 }
コード例 #2
0
  @Override
  public void loadConfig() {
    ModUtil.LOGGER.info("Initializing Not Enough Items Plugin...");

    API.registerGuiOverlay(GuiCrafter.class, "crafting");
    API.registerGuiOverlayHandler(GuiCrafter.class, new DefaultOverlayHandler(), "crafting");

    NEICrusherRecipe crusherRecipe = new NEICrusherRecipe();
    API.registerRecipeHandler(crusherRecipe);
    API.registerUsageHandler(crusherRecipe);

    NEICrusherRecipe.Double crusherDoubleRecipe = new NEICrusherRecipe.Double();
    API.registerRecipeHandler(crusherDoubleRecipe);
    API.registerUsageHandler(crusherDoubleRecipe);

    NEIFurnaceDoubleRecipe furnaceDoubleRecipe = new NEIFurnaceDoubleRecipe();
    API.registerRecipeHandler(furnaceDoubleRecipe);
    API.registerUsageHandler(furnaceDoubleRecipe);

    NEIHairyBallRecipe ballRecipe = new NEIHairyBallRecipe();
    API.registerRecipeHandler(ballRecipe);
    API.registerUsageHandler(ballRecipe);

    NEITreasureChestRecipe treasureChestRecipe = new NEITreasureChestRecipe();
    API.registerRecipeHandler(treasureChestRecipe);
    API.registerUsageHandler(treasureChestRecipe);

    NEICompostRecipe compostRecipe = new NEICompostRecipe();
    API.registerRecipeHandler(compostRecipe);
    API.registerUsageHandler(compostRecipe);

    NEICoffeeMachineRecipe coffeeMachineRecipe = new NEICoffeeMachineRecipe();
    API.registerRecipeHandler(coffeeMachineRecipe);
    API.registerUsageHandler(coffeeMachineRecipe);

    NEIReconstructorRecipe reconstructorRecipe = new NEIReconstructorRecipe();
    API.registerRecipeHandler(reconstructorRecipe);
    API.registerUsageHandler(reconstructorRecipe);

    NEIBookletRecipe bookletRecipe = new NEIBookletRecipe();
    API.registerRecipeHandler(bookletRecipe);
    API.registerUsageHandler(bookletRecipe);

    API.hideItem(new ItemStack(InitBlocks.blockRice));
    API.hideItem(new ItemStack(InitBlocks.blockCanola));
    API.hideItem(new ItemStack(InitBlocks.blockFlax));
    API.hideItem(new ItemStack(InitBlocks.blockCoffee));
    API.hideItem(new ItemStack(InitBlocks.blockWildPlant, 1, Util.WILDCARD));
    API.hideItem(new ItemStack(InitBlocks.blockColoredLampOn, 1, Util.WILDCARD));
  }