示例#1
0
  @EventHandler
  public void initialize(FMLInitializationEvent evt) {
    // MinecraftForge.registerConnectionHandler(new ConnectionHandler());
    ActionManager.registerTriggerProvider(new DefaultTriggerProvider());
    ActionManager.registerActionProvider(new DefaultActionProvider());

    if (BuildCraftCore.modifyWorld) {
      MinecraftForge.EVENT_BUS.register(new SpringPopulate());
    }

    if (BuildCraftCore.loadDefaultRecipes) {
      loadRecipes();
    }
    EntityRegistry.registerModEntity(
        EntityRobot.class, "bcRobot", EntityIds.ROBOT, instance, 50, 1, true);
    EntityRegistry.registerModEntity(
        EntityPowerLaser.class, "bcLaser", EntityIds.LASER, instance, 50, 1, true);
    EntityRegistry.registerModEntity(
        EntityEnergyLaser.class, "bcEnergyLaser", EntityIds.ENERGY_LASER, instance, 50, 1, true);
    EntityList.classToStringMapping.remove(EntityRobot.class);
    EntityList.classToStringMapping.remove(EntityPowerLaser.class);
    EntityList.classToStringMapping.remove(EntityEnergyLaser.class);
    EntityList.stringToClassMapping.remove("BuildCraft|Core.bcRobot");
    EntityList.stringToClassMapping.remove("BuildCraft|Core.bcLaser");
    EntityList.stringToClassMapping.remove("BuildCraft|Core.bcEnergyLaser");

    CoreProxy.proxy.initializeRendering();
    CoreProxy.proxy.initializeEntityRendering();

    Localization.addLocalization("/lang/buildcraft/", DefaultProps.DEFAULT_LANGUAGE);
  }
  @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();
    }
  }
  @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());
  }