예제 #1
0
  public void reloadConfig(ConfigManager.RestartRequirement restartType) {
    if (restartType == ConfigManager.RestartRequirement.GAME) {
      modifyWorld = mainConfigManager.get("worldgen.enable").getBoolean();
      updateFactor = mainConfigManager.get("network.updateFactor").getInt();
      longUpdateFactor = mainConfigManager.get("network.longUpdateFactor").getInt();
      colorBlindMode = mainConfigManager.get("display.colorBlindMode").getBoolean();

      reloadConfig(ConfigManager.RestartRequirement.WORLD);
    } else if (restartType == ConfigManager.RestartRequirement.WORLD) {
      reloadConfig(ConfigManager.RestartRequirement.NONE);
    } else {
      hideFluidNumbers = mainConfigManager.get("display.hideFluidValues").getBoolean();
      hidePowerNumbers = mainConfigManager.get("display.hidePowerValues").getBoolean();
      itemLifespan = mainConfigManager.get("general.itemLifespan").getInt();
      canEnginesExplode = mainConfigManager.get("general.canEnginesExplode").getBoolean();
      consumeWaterSources = mainConfigManager.get("general.pumpsConsumeWater").getBoolean();
      miningMultiplier = (float) mainConfigManager.get("power.miningUsageMultiplier").getDouble();

      if (mainConfigManager.get("general.updateCheck").getBoolean(true)) {
        Version.check();
      }

      if (mainConfiguration.hasChanged()) {
        mainConfiguration.save();
      }
    }
  }
예제 #2
0
  @Mod.EventHandler
  public void init(FMLInitializationEvent evt) {
    BuildCraftAPI.proxy = CoreProxy.proxy;

    ChannelHandler coreChannelHandler = new ChannelHandler();
    coreChannelHandler.registerPacketType(PacketTabletMessage.class);

    channels =
        NetworkRegistry.INSTANCE.newChannel(
            DefaultProps.NET_CHANNEL_NAME + "-CORE", coreChannelHandler, new PacketHandlerCore());

    achievementManager = new AchievementManager("BuildCraft");
    FMLCommonHandler.instance().bus().register(achievementManager);

    woodenGearAchievement =
        achievementManager.registerAchievement(
            new Achievement(
                "achievement.woodenGear", "woodenGearAchievement", 0, 0, woodenGearItem, null));
    stoneGearAchievement =
        achievementManager.registerAchievement(
            new Achievement(
                "achievement.stoneGear",
                "stoneGearAchievement",
                2,
                0,
                stoneGearItem,
                woodenGearAchievement));
    ironGearAchievement =
        achievementManager.registerAchievement(
            new Achievement(
                "achievement.ironGear",
                "ironGearAchievement",
                4,
                0,
                ironGearItem,
                stoneGearAchievement));
    goldGearAchievement =
        achievementManager.registerAchievement(
            new Achievement(
                "achievement.goldGear",
                "goldGearAchievement",
                6,
                0,
                goldGearItem,
                ironGearAchievement));
    diamondGearAchievement =
        achievementManager.registerAchievement(
            new Achievement(
                "achievement.diamondGear",
                "diamondGearAchievement",
                8,
                0,
                diamondGearItem,
                goldGearAchievement));
    wrenchAchievement =
        achievementManager.registerAchievement(
            new Achievement(
                "achievement.wrench", "wrenchAchievement", 3, 2, wrenchItem, stoneGearAchievement));
    engineRedstoneAchievement =
        BuildCraftCore.achievementManager.registerAchievement(
            new Achievement(
                "achievement.redstoneEngine",
                "engineAchievement1",
                1,
                -2,
                new ItemStack(engineBlock, 1, 0),
                BuildCraftCore.woodenGearAchievement));

    // BuildCraft 6.1.4 and below - migration only
    StatementManager.registerParameterClass(
        "buildcraft:stackTrigger", StatementParameterItemStack.class);
    StatementManager.registerParameterClass(
        "buildcraft:stackAction", StatementParameterItemStack.class);

    StatementManager.registerParameterClass(StatementParameterItemStack.class);
    StatementManager.registerParameterClass(StatementParameterDirection.class);
    StatementManager.registerParameterClass(StatementParameterRedstoneGateSideOnly.class);
    StatementManager.registerTriggerProvider(new DefaultTriggerProvider());
    StatementManager.registerActionProvider(new DefaultActionProvider());

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

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

    if (BuildCraftCore.loadDefaultRecipes) {
      loadRecipes();
    }

    BCCreativeTab.get("main").setIcon(new ItemStack(BuildCraftCore.wrenchItem, 1));

    EntityList.stringToClassMapping.remove("BuildCraft|Core.bcLaser");
    EntityList.stringToClassMapping.remove("BuildCraft|Core.bcEnergyLaser");

    BuilderAPI.schematicRegistry.registerSchematicBlock(engineBlock, SchematicEngine.class);

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

    NetworkRegistry.INSTANCE.registerGuiHandler(instance, new CoreGuiHandler());

    FMLCommonHandler.instance().bus().register(TabletManagerClient.INSTANCE);
    FMLCommonHandler.instance().bus().register(TabletManagerServer.INSTANCE);
    MinecraftForge.EVENT_BUS.register(TabletManagerClient.INSTANCE);
    MinecraftForge.EVENT_BUS.register(TabletManagerServer.INSTANCE);

    TabletAPI.registerProgram(new TabletProgramMenuFactory());

    // 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());
      FillerManager.registry.addPattern(new PatternFrame());
    } catch (Error error) {
      BCLog.logErrorAPI("Buildcraft", error, IFillerPattern.class);
      throw error;
    }

    StatementManager.registerParameterClass(PatternParameterYDir.class);
    StatementManager.registerParameterClass(PatternParameterXZDir.class);
    StatementManager.registerParameterClass(PatternParameterCenter.class);
    StatementManager.registerParameterClass(PatternParameterHollow.class);
  }