Exemplo n.º 1
0
  @EventHandler
  public void preInit(FMLPreInitializationEvent evt) {
    Property fillerDestroyProp =
        BuildCraftCore.mainConfiguration.get(
            Configuration.CATEGORY_GENERAL, "filler.destroy", DefaultProps.FILLER_DESTROY);
    fillerDestroyProp.comment = "If true, Filler will destroy blocks instead of breaking them.";
    fillerDestroy = fillerDestroyProp.getBoolean(DefaultProps.FILLER_DESTROY);

    Property fillerLifespanToughProp =
        BuildCraftCore.mainConfiguration.get(
            Configuration.CATEGORY_GENERAL,
            "filler.lifespan.tough",
            DefaultProps.FILLER_LIFESPAN_TOUGH);
    fillerLifespanToughProp.comment =
        "Lifespan in ticks of items dropped by the filler from 'tough' blocks (those that can't be broken by hand)";
    fillerLifespanTough = fillerLifespanToughProp.getInt(DefaultProps.FILLER_LIFESPAN_TOUGH);

    Property fillerLifespanNormalProp =
        BuildCraftCore.mainConfiguration.get(
            Configuration.CATEGORY_GENERAL,
            "filler.lifespan.other",
            DefaultProps.FILLER_LIFESPAN_NORMAL);
    fillerLifespanNormalProp.comment =
        "Lifespan in ticks of items dropped by the filler from non-tough blocks (those that can be broken by hand)";
    fillerLifespanNormal = fillerLifespanNormalProp.getInt(DefaultProps.FILLER_LIFESPAN_NORMAL);

    templateItem = new ItemBptTemplate();
    templateItem.setUnlocalizedName("templateItem");
    LanguageRegistry.addName(templateItem, "Template");
    CoreProxy.proxy.registerItem(templateItem);

    blueprintItem = new ItemBptBluePrint();
    blueprintItem.setUnlocalizedName("blueprintItem");
    LanguageRegistry.addName(blueprintItem, "Blueprint");
    CoreProxy.proxy.registerItem(blueprintItem);

    markerBlock = new BlockMarker();
    CoreProxy.proxy.registerBlock(markerBlock.setBlockName("markerBlock"));

    pathMarkerBlock = new BlockPathMarker();
    CoreProxy.proxy.registerBlock(pathMarkerBlock.setBlockName("pathMarkerBlock"));

    fillerBlock = new BlockFiller();
    CoreProxy.proxy.registerBlock(fillerBlock.setBlockName("fillerBlock"));

    builderBlock = new BlockBuilder();
    CoreProxy.proxy.registerBlock(builderBlock.setBlockName("builderBlock"));

    architectBlock = new BlockArchitect();
    CoreProxy.proxy.registerBlock(architectBlock.setBlockName("architectBlock"));

    libraryBlock = new BlockBlueprintLibrary();
    CoreProxy.proxy.registerBlock(libraryBlock.setBlockName("libraryBlock"));

    GameRegistry.registerTileEntity(TileMarker.class, "Marker");
    GameRegistry.registerTileEntity(TileFiller.class, "Filler");
    GameRegistry.registerTileEntity(TileBuilder.class, "net.minecraft.src.builders.TileBuilder");
    GameRegistry.registerTileEntity(TileArchitect.class, "net.minecraft.src.builders.TileTemplate");
    GameRegistry.registerTileEntity(
        TilePathMarker.class, "net.minecraft.src.builders.TilePathMarker");
    GameRegistry.registerTileEntity(
        TileBlueprintLibrary.class, "net.minecraft.src.builders.TileBlueprintLibrary");

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

    MinecraftForge.EVENT_BUS.register(this);

    // Create filler registry
    try {
      FillerManager.registry = new FillerRegistry();

      // INIT FILLER PATTERNS
      FillerManager.registry.addPattern(PatternFill.INSTANCE);
      FillerManager.registry.addPattern(new PatternFlatten());
      FillerManager.registry.addPattern(new PatternHorizon());
      FillerManager.registry.addPattern(new PatternClear());
      FillerManager.registry.addPattern(new PatternBox());
      FillerManager.registry.addPattern(new PatternPyramid());
      FillerManager.registry.addPattern(new PatternStairs());
      FillerManager.registry.addPattern(new PatternCylinder());
    } catch (Error error) {
      BCLog.logErrorAPI("Buildcraft", error, IFillerPattern.class);
      throw error;
    }

    ActionManager.registerActionProvider(new BuildersActionProvider());
  }
Exemplo n.º 2
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();
      }
    }
  }