Esempio n. 1
0
  @Override
  public void PreInit(FMLPreInitializationEvent event) {
    // TODO: Backpack filler needs a full rewrite thanks to new GameRegistry.
    // filler = new BackpackFiller(event.getModConfigurationDirectory());

    scriptDir =
        new File(
            event.getModConfigurationDirectory(),
            StringHelper.concat("RedGear", StringHelper.slash, "morebackpacks"));

    createBackpack(new BackpackRedstone()); // redstone stuff
    createBackpack(new BackpackFarmer()); // farmable plants, animals
    createBackpack(new BackpackSurvival()); // food
    createBackpack(new BackpackArtist()); // decorative blocks
    createBackpack(new BackpackMagician()); // anything magical
    createBackpack(new BackpackMetallurgist()); // metals
    createBackpack(new BackpackHydraulic()); // anything related to liquids
    createBackpack(new BackpackJewler()); // gems
    createBackpack(
        new BackpackLogistic()); // anything related to transport, from pipes to tubes to rails to
    // hoppers
    createBackpack(new BackpackElectrician()); // anything related to any electricity system
    createBackpack(new BackpackNuclear()); // still only ic2
    createBackpack(new BackpackProgrammer()); // only computercraft or redpower computer stuff
  }
  public static void init(FMLPreInitializationEvent event) {
    configFolder = new File(event.getModConfigurationDirectory(), ModLib.MOD_NAME);
    if (!configFolder.exists()) configFolder.mkdirs();

    config = new Configuration(new File(configFolder, ModLib.MOD_NAME + ".cfg"));
    config.load();

    config.save();
  }
Esempio n. 3
0
  @Mod.EventHandler
  public void preInit(FMLPreInitializationEvent event) {
    path =
        event.getModConfigurationDirectory().getAbsolutePath()
            + File.separator
            + Defaults.MODID.toLowerCase()
            + File.separator;
    ConfigHandler.init(path);

    ModItems.init();
  }
Esempio n. 4
0
  public ConfigHandler(FMLPreInitializationEvent event) {
    this.event = event;
    PATH =
        event.getModConfigurationDirectory() + File.separator + ExtraTools.modID + File.separator;

    blocks = new ArrayList<Block>();
    items = new ArrayList<Item>();
    dh = new GuiIDHandler();
    bh = new BlockHelper();
    ih = new ItemHelper();
  }
Esempio n. 5
0
  @Mod.EventHandler
  public void preInit(FMLPreInitializationEvent event) throws FileNotFoundException {
    ConstructionHandler handler = new ConstructionHandler();
    MinecraftForge.EVENT_BUS.register(handler);
    FMLCommonHandler.instance().bus().register(handler);

    configFile = new File(event.getModConfigurationDirectory(), "kit.json");
    loadConfig(configFile);

    loadLocalization(event.getSuggestedConfigurationFile());
  }
Esempio n. 6
0
  @Mod.EventHandler
  public void preinit(FMLPreInitializationEvent event) {

    /*
    TEC.proxy.register();
    NetworkRegistry.INSTANCE.registerGuiHandler(TEC.instance, TEC.proxy);
    */
    PacketTileSync.init();
    PacketRecieveAspect.init();
    MinecraftForge.EVENT_BUS.register(this);
    FMLCommonHandler.instance().bus().register(this);

    this.initConfig(event.getModConfigurationDirectory());

    this.playerTracker =
        new ItemAugment(TEC.MODID, "playerTracker") {
          @Override
          @SideOnly(Side.CLIENT)
          public void addInformation(
              ItemStack stack, EntityPlayer player, List list, boolean something) {
            if (stack.hasTagCompound()) {
              list.add(
                  "Player: "
                      + (stack.getTagCompound().hasKey("playerName")
                          ? stack.getTagCompound().getString("playerName")
                          : TEC.idToUsername.get(
                              UUID.fromString(stack.getTagCompound().getString("playerUUID")))));
            }
          }

          @Override
          public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
            if (player.isSneaking()) {
              TEC.setPlayerForTracker(stack, player);
              // have to do this because mc doesnt check tags
              player.setCurrentItemOrArmor(0, stack);
            }
            return stack;
          }
        };
    this.playerTracker.setCreativeTab(CreativeTabs.tabRedstone);
    this.decomposerUpgrade = new ItemAugment(TEC.MODID, "decomposer");
    this.decomposerUpgrade.setCreativeTab(CreativeTabs.tabRedstone);
    this.itemKeeper = new ItemAugment(TEC.MODID, "itemKeeper");
    this.itemKeeper.setCreativeTab(CreativeTabs.tabRedstone);
    this.thaumicAdjuster = new ItemAugment(TEC.MODID, "thaumicAdjuster");
    this.thaumicAdjuster.setCreativeTab(CreativeTabs.tabRedstone);

    // todo use config
    TEC.decompositionStats.put(1, new int[] {05, 10});
    TEC.decompositionStats.put(2, new int[] {10, 15});
    TEC.decompositionStats.put(3, new int[] {15, 20});
  }
  public static void init(FMLPreInitializationEvent event) {
    FMLCommonHandler.instance().bus().register(instance);

    if (event != null)
      savePath =
          event.getModConfigurationDirectory().getParentFile().getAbsolutePath()
              + "/config/draconicevolution";
    GUIManual.loadPages();

    downloadThread = new DownloadThread(GUIManual.imageURLs);
    downloadThread.start();
  }
Esempio n. 8
0
 public static void initCommon(FMLPreInitializationEvent evt) {
   Configuration c =
       new Configuration(
           new File(
               evt.getModConfigurationDirectory(),
               Questlog.modID
                   + File.separator
                   + Questlog.modID.toLowerCase(Locale.ENGLISH)
                   + ".cfg"));
   try {
     c.load();
   } catch (Exception e) {
     Questlog.logger.warn("Could not load the config file");
     e.printStackTrace();
   } finally {
     c.save();
   }
 }
  @PreInit
  public void preInit(FMLPreInitializationEvent event) {

    // Initialize the log helper
    LogHelper.init();

    // Load the localization files into the LanguageRegistry
    LocalizationHandler.loadLanguages();

    // Initialize the configuration
    ConfigurationHandler.init(
        new File(
            event.getModConfigurationDirectory().getAbsolutePath()
                + File.separator
                + Reference.CHANNEL_NAME
                + File.separator
                + Reference.MOD_ID
                + ".cfg"));

    // Conduct the version check and log the result
    VersionHelper.execute();

    // Initialize the Version Check Tick Handler (Client only)
    TickRegistry.registerTickHandler(new VersionCheckTickHandler(), Side.CLIENT);

    // Initialize the Render Tick Handler (Client only)
    proxy.registerRenderTickHandler();

    // Register the KeyBinding Handler (Client only)
    proxy.registerKeyBindingHandler();

    // Register the Sound Handler (Client only)
    proxy.registerSoundHandler();

    // Initialize mod blocks
    ModBlocks.init();

    // Initialize mod items
    ModItems.init();
  }
Esempio n. 10
0
 /** {@inheritDoc} */
 @PreInit
 public void preInit(FMLPreInitializationEvent event) {
   config = new Configuration(event.getSuggestedConfigurationFile());
   config.load();
   if (event.getSide() == Side.CLIENT) {
     // Creates the klaxon folder.
     klaxons = new File(event.getModConfigurationDirectory(), "klaxons");
     if (!klaxons.exists()) {
       klaxons.mkdirs();
     }
     FMLLog.log(MOD_ID, Level.INFO, "Folder %s", klaxons);
     // Loads client configuration.
     file = new File(config.get(Configuration.CATEGORY_GENERAL, "Klaxon", "").getString());
     // Loading and loaded klaxons.
     loadingKlaxons = new HashSet<String>();
     loadedKlaxons = new HashSet<String>();
   }
   // Loads shared configuration.
   klaxonId =
       config.get(Configuration.CATEGORY_ITEM, "Klaxon", klaxonDefaultId).getInt(klaxonDefaultId);
   config.save();
 }
  public idManager(FMLPreInitializationEvent event) {
    // idManager configuration
    idmConfigurationFile = new File(event.getModConfigurationDirectory(), "/emc/idManager.cfg");
    idmConfiguration = new Configuration(idmConfigurationFile);
    idmConfiguration.load();

    // Sub configuration
    subConfigurationFile = event.getSuggestedConfigurationFile();
    subConfiguration = new Configuration(subConfigurationFile);
    subConfiguration.load();

    // Current ID
    currentBlockID = idmConfiguration.get("idManager", "minBlockID", minBlockID + 1).getInt();
    currentItemID = idmConfiguration.get("idManager", "minItemID", minItemID + 1).getInt();
    currentBiomeID = idmConfiguration.get("idManager", "minBiomeID", minBiomeID + 1).getInt();
    currentEntityID = idmConfiguration.get("idManager", "minEntityID", minEntityID + 1).getInt();
    currentFoodID = idmConfiguration.get("idManager", "minFoodID", minFoodID + 1).getInt(2020);

    // Save configuration
    idmConfiguration.save();
    subConfiguration.save();
  }
Esempio n. 12
0
  @EventHandler
  public void preInit(FMLPreInitializationEvent event) {

    FMLCommonHandler.instance().bus().register(new KeyHandler());
    ConfigurationHandler.init(
        new File(
            event.getModConfigurationDirectory().getAbsolutePath()
                + File.separator
                + this.author
                + "'s mods"
                + File.separator
                + this.modid
                + ".cfg"));
    proxy.registerKeyBindings();
    NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);

    EntityRegistry.registerModEntity(EntityMudBall.class, "Mud Ball", ++mudID, this, 64, 10, true);
    EntityRegistry.registerModEntity(
        EntityClayBall.class, "Clay Ball", ++clayID, this, 64, 10, true);
    LoadMod.load();

    GameRegistry.registerWorldGenerator(new ClayWorldgen(), 0);
  }
Esempio n. 13
0
  @Mod.EventHandler
  public void preInit(FMLPreInitializationEvent event) throws IOException {
    String configFolderPath =
        event.getModConfigurationDirectory().toString()
            + File.separator
            + Reference.MOD_ID
            + File.separator;

    ForgeConfig.init(event.getSuggestedConfigurationFile());

    Integration.init();

    customItemsTab.init();

    JsonConfigurationHandler.init(configFolderPath, event.getSourceFile());

    GameRegistry.registerWorldGenerator(new CustomWorldGenerator(), 1);

    proxy.registerTileEntities();
    proxy.Integration_NEI();

    MinecraftForge.EVENT_BUS.register(new EntityDropHandler());
    MinecraftForge.EVENT_BUS.register(new BlockDropHandler());
  }
Esempio n. 14
0
  @Mod.EventHandler
  public void preLoad(FMLPreInitializationEvent event) {
    HatHandler.hatsFolder = new File(event.getModConfigurationDirectory().getParent(), "/hats");

    if (!HatHandler.hatsFolder.exists()) {
      HatHandler.hatsFolder.mkdirs();
    }

    boolean isClient = proxy instanceof ClientProxy;

    config =
        ConfigHandler.createConfig(
            event.getSuggestedConfigurationFile(), "hats", "Hats", logger, instance);

    config.setCurrentCategory(
        "globalOptions",
        "hats.config.cat.globalOptions.name",
        "hats.config.cat.globalOptions.comment");
    config.createIntBoolProperty(
        "safeLoad",
        "hats.config.prop.safeLoad.name",
        "hats.config.prop.safeLoad.comment",
        true,
        false,
        true);
    config.createIntBoolProperty(
        "allowSendingOfHats",
        "hats.config.prop.allowSendingOfHats.name",
        "hats.config.prop.allowSendingOfHats.comment",
        true,
        false,
        true);
    config.createIntBoolProperty(
        "allowReceivingOfHats",
        "hats.config.prop.allowReceivingOfHats.name",
        "hats.config.prop.allowReceivingOfHats.comment",
        true,
        false,
        true);
    config.createIntBoolProperty(
        "modMobSupport",
        "hats.config.prop.modMobSupport.name",
        "hats.config.prop.modMobSupport.comment",
        true,
        false,
        true);
    config.createIntBoolProperty(
        "readLocalModMobSupport",
        "hats.config.prop.readLocalModMobSupport.name",
        "hats.config.prop.readLocalModMobSupport.comment",
        true,
        false,
        false);

    config.setCurrentCategory(
        "serverOptions",
        "hats.config.cat.serverOptions.name",
        "hats.config.cat.serverOptions.comment");
    config.createIntProperty(
        "playerHatsMode",
        "hats.config.prop.playerHatsMode.name",
        "hats.config.prop.playerHatsMode.comment",
        true,
        true,
        4,
        1,
        6);
    config.createIntBoolProperty(
        "firstJoinMessage",
        "hats.config.prop.firstJoinMessage.name",
        "hats.config.prop.firstJoinMessage.comment",
        true,
        false,
        true);
    config.createStringProperty(
        "lockedHat",
        "hats.config.prop.lockedHat.name",
        "hats.config.prop.lockedHat.comment",
        true,
        true,
        "Straw Hat");
    config.createIntProperty(
        "startTime",
        "hats.config.prop.startTime.name",
        "hats.config.prop.startTime.comment",
        false,
        false,
        6000,
        10,
        Integer.MAX_VALUE);
    config.createIntProperty(
        "timeIncrement",
        "hats.config.prop.timeIncrement.name",
        "hats.config.prop.timeIncrement.comment",
        false,
        false,
        125,
        0,
        Integer.MAX_VALUE);
    config.createIntBoolProperty(
        "resetPlayerHatsOnDeath",
        "hats.config.prop.resetPlayerHatsOnDeath.name",
        "hats.config.prop.resetPlayerHatsOnDeath.comment",
        true,
        false,
        false);
    config.createIntBoolProperty(
        "hatRarity",
        "hats.config.prop.hatRarity.name",
        "hats.config.prop.hatRarity.comment",
        true,
        false,
        true);
    config.createIntProperty(
        "hatGenerationSeed",
        "hats.config.prop.hatGenerationSeed.name",
        "hats.config.prop.hatGenerationSeed.comment",
        true,
        true,
        (new Random(System.currentTimeMillis())).nextInt(),
        Integer.MIN_VALUE,
        Integer.MAX_VALUE);

    if (isClient) {
      config.setCurrentCategory(
          "clientOnly", "hats.config.cat.clientOnly.name", "hats.config.cat.clientOnly.comment");
      config.createIntBoolProperty(
          "renderInFirstPerson",
          "hats.config.prop.renderInFirstPerson.name",
          "hats.config.prop.renderInFirstPerson.comment",
          true,
          false,
          false);
      config.createIntBoolProperty(
          "enableInServersWithoutMod",
          "hats.config.prop.enableInServersWithoutMod.name",
          "hats.config.prop.enableInServersWithoutMod.comment",
          true,
          false,
          true);
      config.createIntBoolProperty(
          "shouldOtherPlayersHaveHats",
          "hats.config.prop.shouldOtherPlayersHaveHats.name",
          "hats.config.prop.shouldOtherPlayersHaveHats.comment",
          true,
          false,
          true);
      config.createIntProperty(
          "randomHat",
          "hats.config.prop.randomHat.name",
          "hats.config.prop.randomHat.comment",
          true,
          false,
          2,
          0,
          2);

      String favHat =
          config.createStringProperty(
              "favouriteHat",
              "hats.config.prop.favouriteHat.name",
              "hats.config.prop.favouriteHat.comment",
              true,
              false,
              "Top Hat");
      int clr =
          config.createColourProperty(
              "favouriteHatColourizer",
              "hats.config.prop.favouriteHatColourizer.name",
              "hats.config.prop.favouriteHatColourizer.comment",
              true,
              false,
              0xffffff);
      favouriteHatInfo =
          new HatInfo(favHat.toLowerCase(), clr >> 16 & 255, clr >> 8 & 255, clr & 255, 255);

      config.createKeybindProperty(
          "guiKeyBind",
          "hats.config.prop.guiKeyBind.name",
          "hats.config.prop.guiKeyBind.comment",
          Keyboard.KEY_H,
          false,
          false,
          false,
          false,
          0,
          true);
      config.createStringProperty(
          "personalizeEnabled",
          "hats.config.prop.personalizeEnabled.name",
          "hats.config.prop.personalizeEnabled.comment",
          true,
          false,
          "1 2 3 4 5 6 7 8 9");
      config.createIntProperty(
          "maxHatRenders",
          "hats.config.prop.maxHatRenders.name",
          "hats.config.prop.maxHatRenders.comment",
          true,
          false,
          300,
          0,
          5000);
      config.createIntBoolProperty(
          "showContributorHatsInGui",
          "hats.config.prop.showContributorHatsInGui.name",
          "hats.config.prop.showContributorHatsInGui.comment",
          true,
          false,
          true);

      config.createIntBoolProperty(
          "renderHats",
          "hats.config.prop.renderHats.name",
          "hats.config.prop.renderHats.comment",
          true,
          true,
          true);
    }

    config.setCurrentCategory(
        "randoMobOptions",
        "hats.config.cat.randoMobOptions.name",
        "hats.config.cat.randoMobOptions.comment");
    config.createIntProperty(
        "randomMobHat",
        "hats.config.prop.randomMobHat.name",
        "hats.config.prop.randomMobHat.comment",
        true,
        false,
        config.getInt("playerHatsMode") != 4 && isClient ? 0 : 10,
        0,
        100);
    config.createIntProperty(
        "useRandomContributorHats",
        "hats.config.prop.useRandomContributorHats.name",
        "hats.config.prop.useRandomContributorHats.comment",
        true,
        false,
        80,
        0,
        100);

    config.createIntBoolProperty(
        "hatBat",
        "hats.config.prop.hatBat.name",
        "hats.config.prop.hatBat.comment",
        true,
        false,
        true);
    config.createIntBoolProperty(
        "hatBlaze",
        "hats.config.prop.hatBlaze.name",
        "hats.config.prop.hatBlaze.comment",
        true,
        false,
        true);
    config.createIntBoolProperty(
        "hatChicken",
        "hats.config.prop.hatChicken.name",
        "hats.config.prop.hatChicken.comment",
        true,
        false,
        true);
    config.createIntBoolProperty(
        "hatCow",
        "hats.config.prop.hatCow.name",
        "hats.config.prop.hatCow.comment",
        true,
        false,
        true);
    config.createIntBoolProperty(
        "hatCreeper",
        "hats.config.prop.hatCreeper.name",
        "hats.config.prop.hatCreeper.comment",
        true,
        false,
        true);
    config.createIntBoolProperty(
        "hatEnderman",
        "hats.config.prop.hatEnderman.name",
        "hats.config.prop.hatEnderman.comment",
        true,
        false,
        true);
    config.createIntBoolProperty(
        "hatGhast",
        "hats.config.prop.hatGhast.name",
        "hats.config.prop.hatGhast.comment",
        true,
        false,
        true);
    config.createIntBoolProperty(
        "hatHorse",
        "hats.config.prop.hatHorse.name",
        "hats.config.prop.hatHorse.comment",
        true,
        false,
        true);
    config.createIntBoolProperty(
        "hatOcelot",
        "hats.config.prop.hatOcelot.name",
        "hats.config.prop.hatOcelot.comment",
        true,
        false,
        true);
    config.createIntBoolProperty(
        "hatPig",
        "hats.config.prop.hatPig.name",
        "hats.config.prop.hatPig.comment",
        true,
        false,
        true);
    config.createIntBoolProperty(
        "hatSheep",
        "hats.config.prop.hatSheep.name",
        "hats.config.prop.hatSheep.comment",
        true,
        false,
        true);
    config.createIntBoolProperty(
        "hatSkeleton",
        "hats.config.prop.hatSkeleton.name",
        "hats.config.prop.hatSkeleton.comment",
        true,
        false,
        true);
    config.createIntBoolProperty(
        "hatSlime",
        "hats.config.prop.hatSlime.name",
        "hats.config.prop.hatSlime.comment",
        true,
        false,
        true);
    config.createIntBoolProperty(
        "hatSpider",
        "hats.config.prop.hatSpider.name",
        "hats.config.prop.hatSpider.comment",
        true,
        false,
        true);
    config.createIntBoolProperty(
        "hatSquid",
        "hats.config.prop.hatSquid.name",
        "hats.config.prop.hatSquid.comment",
        true,
        false,
        true);
    config.createIntBoolProperty(
        "hatVillager",
        "hats.config.prop.hatVillager.name",
        "hats.config.prop.hatVillager.comment",
        true,
        false,
        true);
    config.createIntBoolProperty(
        "hatWither",
        "hats.config.prop.hatWither.name",
        "hats.config.prop.hatWither.comment",
        true,
        false,
        true);
    config.createIntBoolProperty(
        "hatWolf",
        "hats.config.prop.hatWolf.name",
        "hats.config.prop.hatWolf.comment",
        true,
        false,
        true);
    config.createIntBoolProperty(
        "hatZombie",
        "hats.config.prop.hatZombie.name",
        "hats.config.prop.hatZombie.comment",
        true,
        false,
        true);

    //		handleConfig();

    ModVersionChecker.register_iChunMod(
        new ModVersionInfo("Hats", iChunUtil.versionOfMC, version, false));
  }
  @EventHandler
  public void preInitialize(FMLPreInitializationEvent evt) {

    aboLog.setParent(FMLLog.getLogger());
    aboLog.info(
        "Starting Additional-Buildcraft-Objects #@BUILD_NUMBER@ "
            + VERSION
            + " (Built for Minecraft @MINECRAFT_VERSION@ with Buildcraft @BUILDCRAFT_VERSION@ and Forge @FORGE_VERSION@");
    aboLog.info("Copyright (c) Flow86, 2011-2013");

    aboConfiguration =
        new ABOConfiguration(new File(evt.getModConfigurationDirectory(), "abo/main.conf"));
    try {
      aboConfiguration.load();

      itemGateSettingsDuplicator =
          createItem(
              itemGateSettingsDuplicatorID,
              ItemGateSettingsDuplicator.class,
              "Gate Settings Duplicator",
              BuildCraftCore.wrenchItem,
              BuildCraftTransport.pipeGateAutarchic,
              null);

      pipeFluidsValve =
          createPipe(
              pipeFluidsValveID,
              PipeFluidsValve.class,
              "Valve Pipe",
              1,
              BuildCraftTransport.pipeFluidsWood,
              BuildCraftTransport.pipeGateAutarchic,
              null);

      pipeFluidsGoldenIron =
          createPipe(
              pipeFluidsGoldenIronID,
              PipeFluidsGoldenIron.class,
              "Golden Iron Waterproof Pipe",
              1,
              BuildCraftTransport.pipeFluidsGold,
              BuildCraftTransport.pipeFluidsIron,
              null);

      pipeFluidsBalance =
          createPipe(
              pipeFluidsBalanceID,
              PipeFluidsBalance.class,
              "Balancing Waterproof Pipe",
              1,
              BuildCraftTransport.pipeFluidsWood,
              new ItemStack(BuildCraftEnergy.engineBlock, 1, 0),
              BuildCraftTransport.pipeFluidsWood);

      pipeFluidsDiamond =
          createPipe(
              pipeFluidsDiamondID,
              PipeFluidsDistribution.class,
              "Diamond Waterproof Pipe",
              1,
              BuildCraftTransport.pipeItemsDiamond,
              BuildCraftTransport.pipeWaterproof,
              null);

      if (GameRegistry.findItem("APUnofficial", "item.PipeFluidsWaterPump") == null) {
        pipeFluidsWaterPump =
            createPipe(
                pipeFluidsWaterPumpID,
                PipeFluidsPump.class,
                "Water Pump Pipe",
                1,
                false,
                new Object[] {
                  " L ",
                  "rPr",
                  " W ",
                  'r',
                  Item.redstone,
                  'P',
                  BuildCraftCore.ironGearItem,
                  'L',
                  BuildCraftTransport.pipeFluidsGold,
                  'W',
                  BuildCraftTransport.pipeFluidsWood
                });
      }

      pipeItemsRoundRobin =
          createPipe(
              pipeItemsRoundRobinID,
              PipeItemsRoundRobin.class,
              "RoundRobin Transport Pipe",
              1,
              BuildCraftTransport.pipeItemsStone,
              Block.gravel,
              null);

      pipeItemsCompactor =
          createPipe(
              pipeItemsCompactorID,
              PipeItemsCompactor.class,
              "Compactor Pipe",
              1,
              BuildCraftTransport.pipeItemsStone,
              Block.pistonBase,
              null);

      pipeItemsInsertion =
          createPipe(
              pipeItemsInsertionID,
              PipeItemsInsertion.class,
              "Insertion Pipe",
              1,
              BuildCraftTransport.pipeItemsIron,
              new ItemStack(Item.dyePowder, 1, 2),
              null);

      pipeItemsExtraction =
          createPipe(
              pipeItemsExtractionID,
              PipeItemsExtraction.class,
              "Extraction Transport Pipe",
              1,
              BuildCraftTransport.pipeItemsWood,
              Block.planks,
              null);

      pipeItemsBounce =
          createPipe(
              pipeItemsBounceID,
              PipeItemsBounce.class,
              "Bounce Transport Pipe",
              1,
              BuildCraftTransport.pipeItemsStone,
              Block.cobblestone,
              null);

      pipeItemsCrossover =
          createPipe(
              pipeItemsCrossoverID,
              PipeItemsCrossover.class,
              "Crossover Transport Pipe",
              1,
              BuildCraftTransport.pipeItemsStone,
              BuildCraftTransport.pipeItemsIron,
              null);

      pipeItemsStripes =
          createPipe(
              pipeItemsStripesID,
              PipeItemsStripes.class,
              "Stripes Transport Pipe",
              8,
              new ItemStack(Item.dyePowder, 1, 0),
              Block.glass,
              new ItemStack(Item.dyePowder, 1, 11));

      pipePowerSwitch =
          createPipe(
              pipePowerSwitchID,
              PipePowerSwitch.class,
              "Power Switch Pipe",
              1,
              BuildCraftTransport.pipePowerGold,
              Block.lever,
              null);

      pipePowerIron =
          createPipe(
              pipePowerIronID,
              PipePowerIron.class,
              "Iron Power Pipe",
              1,
              Item.redstone,
              BuildCraftTransport.pipeItemsIron,
              null);

      pipeDistributionConductive =
          createPipe(
              pipeDistributionConductiveID,
              PipePowerDistribution.class,
              "Distribution Conductive Pipe",
              2,
              pipePowerIron,
              BuildCraftTransport.pipeItemsDiamond,
              pipePowerIron);

      triggerEngineSafe = new TriggerEngineSafe(triggerEngineSafeID);
      actionSwitchOnPipe = new ActionSwitchOnPipe(actionSwitchOnPipeID);
      actionToggleOnPipe = new ActionToggleOnPipe(actionToggleOnPipeID);
      actionToggleOffPipe = new ActionToggleOffPipe(actionToggleOffPipeID);

      ActionManager.registerActionProvider(new ABOActionProvider());
      ActionManager.registerTriggerProvider(new ABOTriggerProvider());

      BuildCraftCore.itemBptProps[pipeItemsExtraction.itemID] = new BptItemPipeWooden();
      BuildCraftCore.itemBptProps[pipeFluidsValve.itemID] = new BptItemPipeIron();
      BuildCraftCore.itemBptProps[pipeFluidsGoldenIron.itemID] = new BptItemPipeIron();
      BuildCraftCore.itemBptProps[pipeFluidsDiamond.itemID] = new BptItemPipeDiamond();
      BuildCraftCore.itemBptProps[pipePowerIron.itemID] = new BptItemPipeIron();

      MinecraftForge.EVENT_BUS.register(this);
    } finally {
      if (aboConfiguration.hasChanged()) aboConfiguration.save();
    }
  }
Esempio n. 16
0
  @Mod.EventHandler
  public void loadConfiguration(FMLPreInitializationEvent evt) {
    BCLog.initLog();

    new BCCreativeTab("main");

    commandBuildcraft.addAlias("bc");
    commandBuildcraft.addChildCommand(new SubCommandVersion());
    commandBuildcraft.addChildCommand(new SubCommandChangelog());

    BuildcraftRecipeRegistry.assemblyTable = AssemblyRecipeManager.INSTANCE;
    BuildcraftRecipeRegistry.integrationTable = IntegrationRecipeManager.INSTANCE;
    BuildcraftRecipeRegistry.refinery = RefineryRecipeManager.INSTANCE;
    BuildcraftRecipeRegistry.programmingTable = ProgrammingRecipeManager.INSTANCE;

    BuilderAPI.schematicRegistry = SchematicRegistry.INSTANCE;

    mainConfiguration =
        new BuildCraftConfiguration(
            new File(evt.getModConfigurationDirectory(), "buildcraft/main.cfg"));
    mainConfigManager = new ConfigManager(mainConfiguration);
    mainConfiguration.load();

    mainConfigManager.getCat("debug").setShowInGui(false);
    mainConfigManager.getCat("vars").setShowInGui(false);

    mainConfigManager.register(
        "general.updateCheck",
        true,
        "Should I check the BuildCraft version on startup?",
        ConfigManager.RestartRequirement.NONE);
    mainConfigManager.register(
        "display.hidePowerValues",
        false,
        "Should all power values (RF, RF/t) be hidden?",
        ConfigManager.RestartRequirement.NONE);
    mainConfigManager.register(
        "display.hideFluidValues",
        false,
        "Should all fluid values (mB, mB/t) be hidden?",
        ConfigManager.RestartRequirement.NONE);
    mainConfigManager
        .register(
            "general.itemLifespan",
            60,
            "How long, in seconds, should items stay on the ground? (Vanilla = 300, default = 60)",
            ConfigManager.RestartRequirement.NONE)
        .setMinValue(5);
    mainConfigManager
        .register(
            "network.updateFactor",
            10,
            "How often, in ticks, should network update packets be sent? Increasing this might help network performance.",
            ConfigManager.RestartRequirement.GAME)
        .setMinValue(1);
    mainConfigManager
        .register(
            "network.longUpdateFactor",
            40,
            "How often, in ticks, should full network sync packets be sent? Increasing this might help network performance.",
            ConfigManager.RestartRequirement.GAME)
        .setMinValue(1);
    mainConfigManager.register(
        "general.canEnginesExplode",
        false,
        "Should engines explode upon overheat?",
        ConfigManager.RestartRequirement.NONE);
    mainConfigManager.register(
        "worldgen.enable",
        true,
        "Should BuildCraft generate anything in the world?",
        ConfigManager.RestartRequirement.GAME);
    mainConfigManager.register(
        "general.pumpsConsumeWater",
        false,
        "Should pumps consume water? Enabling this might cause performance issues!",
        ConfigManager.RestartRequirement.NONE);
    mainConfigManager.register(
        "power.miningUsageMultiplier",
        1.0D,
        "What should the multiplier of all mining-related power usage be?",
        ConfigManager.RestartRequirement.NONE);
    mainConfigManager.register(
        "display.colorBlindMode",
        false,
        "Should I enable colorblind mode?",
        ConfigManager.RestartRequirement.GAME);
    mainConfigManager.register(
        "worldgen.generateWaterSprings",
        true,
        "Should BuildCraft generate water springs?",
        ConfigManager.RestartRequirement.GAME);

    reloadConfig(ConfigManager.RestartRequirement.GAME);

    wrenchItem = (new ItemWrench()).setUnlocalizedName("wrenchItem");
    CoreProxy.proxy.registerItem(wrenchItem);

    mapLocationItem = (new ItemMapLocation()).setUnlocalizedName("mapLocation");
    CoreProxy.proxy.registerItem(mapLocationItem);

    listItem = (ItemList) (new ItemList()).setUnlocalizedName("list");
    CoreProxy.proxy.registerItem(listItem);

    debuggerItem = (new ItemDebugger()).setUnlocalizedName("debugger");
    CoreProxy.proxy.registerItem(debuggerItem);

    if (BuildCraftCore.modifyWorld) {
      BlockSpring.EnumSpring.WATER.canGen =
          BuildCraftCore.mainConfigManager.get("worldgen.generateWaterSprings").getBoolean();
      springBlock = new BlockSpring().setBlockName("eternalSpring");
      CoreProxy.proxy.registerBlock(springBlock, ItemSpring.class);
    }

    woodenGearItem = (new ItemGear()).setUnlocalizedName("woodenGearItem");
    CoreProxy.proxy.registerItem(woodenGearItem);
    OreDictionary.registerOre("gearWood", new ItemStack(woodenGearItem));

    stoneGearItem = (new ItemGear()).setUnlocalizedName("stoneGearItem");
    CoreProxy.proxy.registerItem(stoneGearItem);
    OreDictionary.registerOre("gearStone", new ItemStack(stoneGearItem));

    ironGearItem = (new ItemGear()).setUnlocalizedName("ironGearItem");
    CoreProxy.proxy.registerItem(ironGearItem);
    OreDictionary.registerOre("gearIron", new ItemStack(ironGearItem));

    goldGearItem = (new ItemGear()).setUnlocalizedName("goldGearItem");
    CoreProxy.proxy.registerItem(goldGearItem);
    OreDictionary.registerOre("gearGold", new ItemStack(goldGearItem));

    diamondGearItem = (new ItemGear()).setUnlocalizedName("diamondGearItem");
    CoreProxy.proxy.registerItem(diamondGearItem);
    OreDictionary.registerOre("gearDiamond", new ItemStack(diamondGearItem));

    paintbrushItem = (new ItemPaintbrush()).setUnlocalizedName("paintbrush");
    CoreProxy.proxy.registerItem(paintbrushItem);

    if (TABLET_TESTING) {
      tabletItem = new ItemTablet();
      tabletItem.setUnlocalizedName("tablet");
      CoreProxy.proxy.registerItem(tabletItem);
    }

    buildToolBlock = new BlockBuildTool();
    buildToolBlock.setBlockName("buildToolBlock");
    CoreProxy.proxy.registerBlock(buildToolBlock);

    engineBlock = (BlockEngine) CompatHooks.INSTANCE.getBlock(BlockEngine.class);
    CoreProxy.proxy.registerBlock(engineBlock, ItemEngine.class);
    engineBlock.registerTile(
        (Class<? extends TileEngineBase>) CompatHooks.INSTANCE.getTile(TileEngineWood.class),
        "tile.engineWood");
    CoreProxy.proxy.registerTileEntity(
        TileEngineWood.class, "net.minecraft.src.buildcraft.energy.TileEngineWood");

    FMLCommonHandler.instance().bus().register(this);
    MinecraftForge.EVENT_BUS.register(this);
    MinecraftForge.EVENT_BUS.register(new BlockHighlightHandler());
  }
Esempio n. 17
0
  @EventHandler
  public void loadConfiguration(FMLPreInitializationEvent evt) {

    BCLog.initLog();

    mainConfiguration =
        new BuildCraftConfiguration(
            new File(evt.getModConfigurationDirectory(), "buildcraft/main.conf"));
    try {
      mainConfiguration.load();

      Property updateCheck =
          BuildCraftCore.mainConfiguration.get(
              Configuration.CATEGORY_GENERAL, "update.check", true);
      updateCheck.comment = "set to true for version check on startup";
      if (updateCheck.getBoolean(true)) {
        Version.check();
      }

      Property continuousCurrent =
          BuildCraftCore.mainConfiguration.get(
              Configuration.CATEGORY_GENERAL,
              "current.continuous",
              DefaultProps.CURRENT_CONTINUOUS);
      continuousCurrent.comment =
          "set to true for allowing machines to be driven by continuous current";
      continuousCurrentModel = continuousCurrent.getBoolean(DefaultProps.CURRENT_CONTINUOUS);

      Property trackNetwork =
          BuildCraftCore.mainConfiguration.get(
              Configuration.CATEGORY_GENERAL, "trackNetworkUsage", false);
      trackNetworkUsage = trackNetwork.getBoolean(false);

      Property dropBlock =
          BuildCraftCore.mainConfiguration.get(
              Configuration.CATEGORY_GENERAL, "dropBrokenBlocks", true);
      dropBlock.comment = "set to false to prevent fillers from dropping blocks.";
      dropBrokenBlocks = dropBlock.getBoolean(true);

      Property lifespan =
          BuildCraftCore.mainConfiguration.get(
              Configuration.CATEGORY_GENERAL, "itemLifespan", itemLifespan);
      lifespan.comment =
          "the lifespan in ticks of items dropped on the ground by pipes and machines, vanilla = 6000, default = 1200";
      itemLifespan = lifespan.getInt(itemLifespan);
      if (itemLifespan < 100) {
        itemLifespan = 100;
      }

      Property powerFrameworkClass =
          BuildCraftCore.mainConfiguration.get(
              Configuration.CATEGORY_GENERAL,
              "power.framework",
              "buildcraft.energy.PneumaticPowerFramework");

      Property factor =
          BuildCraftCore.mainConfiguration.get(
              Configuration.CATEGORY_GENERAL, "network.updateFactor", 10);
      factor.comment =
          "increasing this number will decrease network update frequency, useful for overloaded servers";
      updateFactor = factor.getInt(10);

      Property longFactor =
          BuildCraftCore.mainConfiguration.get(
              Configuration.CATEGORY_GENERAL, "network.stateRefreshPeriod", 40);
      longFactor.comment =
          "delay between full client sync packets, increasing it saves bandwidth, decreasing makes for better client syncronization.";
      longUpdateFactor = longFactor.getInt(40);

      Property wrenchId =
          BuildCraftCore.mainConfiguration.getItem("wrench.id", DefaultProps.WRENCH_ID);

      wrenchItem =
          (new ItemWrench(wrenchId.getInt(DefaultProps.WRENCH_ID)))
              .setUnlocalizedName("wrenchItem");
      LanguageRegistry.addName(wrenchItem, "Wrench");
      CoreProxy.proxy.registerItem(wrenchItem);

      Property springId =
          BuildCraftCore.mainConfiguration.getBlock("springBlock.id", DefaultProps.SPRING_ID);

      Property woodenGearId =
          BuildCraftCore.mainConfiguration.getItem(
              "woodenGearItem.id", DefaultProps.WOODEN_GEAR_ID);
      Property stoneGearId =
          BuildCraftCore.mainConfiguration.getItem("stoneGearItem.id", DefaultProps.STONE_GEAR_ID);
      Property ironGearId =
          BuildCraftCore.mainConfiguration.getItem("ironGearItem.id", DefaultProps.IRON_GEAR_ID);
      Property goldenGearId =
          BuildCraftCore.mainConfiguration.getItem(
              "goldenGearItem.id", DefaultProps.GOLDEN_GEAR_ID);
      Property diamondGearId =
          BuildCraftCore.mainConfiguration.getItem(
              "diamondGearItem.id", DefaultProps.DIAMOND_GEAR_ID);
      Property modifyWorldProp =
          BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "modifyWorld", true);
      modifyWorldProp.comment =
          "set to false if BuildCraft should not generate custom blocks (e.g. oil)";
      modifyWorld = modifyWorldProp.getBoolean(true);

      Property consumeWater =
          BuildCraftCore.mainConfiguration.get(
              Configuration.CATEGORY_GENERAL, "consumeWater", consumeWaterSources);
      consumeWaterSources = consumeWater.getBoolean(consumeWaterSources);
      consumeWater.comment = "set to true if the Pump should consume water";

      if (BuildCraftCore.modifyWorld) {
        springBlock = new BlockSpring(springId.getInt()).setUnlocalizedName("eternalSpring");
        CoreProxy.proxy.registerBlock(springBlock, ItemSpring.class);
      }

      woodenGearItem =
          (new ItemBuildCraft(woodenGearId.getInt())).setUnlocalizedName("woodenGearItem");
      LanguageRegistry.addName(woodenGearItem, "Wooden Gear");
      CoreProxy.proxy.registerItem(woodenGearItem);
      OreDictionary.registerOre("gearWood", new ItemStack(woodenGearItem));

      stoneGearItem =
          (new ItemBuildCraft(stoneGearId.getInt())).setUnlocalizedName("stoneGearItem");
      LanguageRegistry.addName(stoneGearItem, "Stone Gear");
      CoreProxy.proxy.registerItem(stoneGearItem);
      OreDictionary.registerOre("gearStone", new ItemStack(stoneGearItem));

      ironGearItem = (new ItemBuildCraft(ironGearId.getInt())).setUnlocalizedName("ironGearItem");
      LanguageRegistry.addName(ironGearItem, "Iron Gear");
      CoreProxy.proxy.registerItem(ironGearItem);
      OreDictionary.registerOre("gearIron", new ItemStack(ironGearItem));

      goldGearItem = (new ItemBuildCraft(goldenGearId.getInt())).setUnlocalizedName("goldGearItem");
      LanguageRegistry.addName(goldGearItem, "Gold Gear");
      CoreProxy.proxy.registerItem(goldGearItem);
      OreDictionary.registerOre("gearGold", new ItemStack(goldGearItem));

      diamondGearItem =
          (new ItemBuildCraft(diamondGearId.getInt())).setUnlocalizedName("diamondGearItem");
      LanguageRegistry.addName(diamondGearItem, "Diamond Gear");
      CoreProxy.proxy.registerItem(diamondGearItem);
      OreDictionary.registerOre("gearDiamond", new ItemStack(diamondGearItem));

      Property colorBlindProp =
          BuildCraftCore.mainConfiguration.get(
              Configuration.CATEGORY_GENERAL, "client.colorblindmode", false);
      colorBlindProp.comment = "Set to true to enable alternate textures";
      colorBlindMode = colorBlindProp.getBoolean(false);

      MinecraftForge.EVENT_BUS.register(this);

    } finally {
      if (mainConfiguration.hasChanged()) {
        mainConfiguration.save();
      }
    }
  }