Exemple #1
0
 /**
  * Opens a dialog window to select which file to save to, then performs rendering of the map of
  * current dimension into a PNG image.
  */
 private void exportImage(ItemStack stack) {
   boolean showMarkers = !state.is(HIDING_MARKERS);
   state.switchTo(EXPORTING_IMAGE);
   // Default file name is "Atlas <N>.png"
   File file = ExportImageUtil.selectPngFileToSave("Atlas " + stack.getItemDamage(), progressBar);
   if (file != null) {
     try {
       Log.info(
           "Exporting image from Atlas #%d to file %s",
           stack.getItemDamage(), file.getAbsolutePath());
       ExportImageUtil.exportPngImage(
           biomeData, globalMarkersData, localMarkersData, file, progressBar, showMarkers);
       Log.info("Finished exporting image");
     } catch (OutOfMemoryError e) {
       Log.error(e, "Image is too large");
       progressBar.setStatusString(I18n.format("gui.antiqueatlas.export.tooLarge"));
       return; // Don't switch to normal state yet so that the error message can be read.
     }
   }
   state.switchTo(showMarkers ? NORMAL : HIDING_MARKERS);
 }
  @EventHandler
  public void preInit(FMLPreInitializationEvent event) {
    Log.setModID(ID);
    proxy.preInit(event);
    settings.load(new File(proxy.configDir, "settings.cfg"));

    itemAtlas = (ItemAtlas) new ItemAtlas(settings).setUnlocalizedName("antiqueAtlas");

    itemEmptyAtlas =
        (ItemEmptyAtlas)
            new ItemEmptyAtlas()
                .setUnlocalizedName("emptyAntiqueAtlas")
                .setCreativeTab(CreativeTabs.tabTools);

    GameRegistry.registerItem(itemAtlas, "antiqueAtlas");
    GameRegistry.registerItem(itemEmptyAtlas, "emptyAntiqueAtlas");
  }