Exemplo n.º 1
0
  @Mod.EventHandler
  @Override
  public void preLoad(FMLPreInitializationEvent event) {
    super.preLoad(event);
    BushManager.populateBushInfo();

    try {
      config.load();

      dummyLeaves = new BlockFruitLeavesDummy();

      debug = config.get(Configuration.CATEGORY_GENERAL, "debug", false).getBoolean(false);
      bonemealingAllowed =
          config.get(Configuration.CATEGORY_GENERAL, "bonemeal", true).getBoolean(true);

      for (int i = 0; i < leavesBlocksAllocated; i++) {
        leavesList.add(new LeavesInfo(i));
      }

      ItemBagPlanting.blackList()
          .loadFromString(
              config
                  .get(
                      Configuration.CATEGORY_GENERAL,
                      "plantingBagBlackList",
                      "",
                      "Planting bag will ignore these items. Format of item (separated by ',' or ';'): <id>[:meta]")
                  .getString());
      ItemBagPlanting.blackList().printToLog(Log);
      TileFruitCollector.fruitCollectorRange =
          config.get(Configuration.CATEGORY_GENERAL, "fruitCollectorRange", 16).getInt();
    } catch (Exception e) {
      FMLLog.log(Level.FATAL, e, "Mod Jaffas (trees) can't read config file.");
    } finally {
      config.save();
    }

    if (!ModuleManager.isModuleEnabled(ModulesEnum.trees)) return;

    creativeTab = new JaffaCreativeTab("jaffas.trees");
    guiHandler = new GuiHandlerTrees();
    NetworkRegistry.INSTANCE.registerGuiHandler(this, guiHandler);

    JaffasRegistryHelper.registerTileEntity(TileFruitLeaves.class, "fruitLeaves");
    JaffasRegistryHelper.registerTileEntity(TileJaffaCrops.class, "jaffaCrops");

    CompostRegister.init();
    createItems();

    MinecraftForge.addGrassSeed(new ItemStack(itemUnknownSeeds), SEEDS_WEIGHT);

    installRecipes();

    // texture stuff
    proxy.registerRenderThings();

    registerForestryStuff();

    creativeTab.setup(ItemManager.getItem(JaffaItem.oranges));
    LanguageRegistry.instance()
        .addStringLocalization("itemGroup.jaffas.trees", "en_US", "Jaffas and more! Trees");
  }