Search in sources :

Example 1 with EnumRestartRequirement

use of buildcraft.lib.config.EnumRestartRequirement in project BuildCraft by BuildCraft.

the class BCBuildersConfig method preInit.

public static void preInit() {
    EnumRestartRequirement none = EnumRestartRequirement.NONE;
    EnumRestartRequirement game = EnumRestartRequirement.GAME;
    propBptStoreExternalThreshold = BCCoreConfig.config.get("general", "bptStoreExternalThreshold", 20_000);
    none.setTo(propBptStoreExternalThreshold);
    propQuarryFrameMinHeight = BCCoreConfig.config.get("general", "quarryFrameMinHeight", 4);
    propQuarryFrameMinHeight.setComment("The minimum height that all quarry frames must be. A value of 1 will look strange when it drills the uppermost layer.");
    propQuarryFrameMinHeight.setMinValue(1);
    none.setTo(propQuarryFrameMinHeight);
    propQuarryFrameMoveBoth = BCCoreConfig.config.get("display", "quarryFrameMoveBoth", false);
    propQuarryFrameMoveBoth.setComment("If true then the quarry frame will move with both of its axis rather than just one.");
    none.setTo(propQuarryFrameMoveBoth);
    reloadConfig(EnumRestartRequirement.GAME);
    BCCoreConfig.addReloadListener(BCBuildersConfig::reloadConfig);
}
Also used : EnumRestartRequirement(buildcraft.lib.config.EnumRestartRequirement)

Example 2 with EnumRestartRequirement

use of buildcraft.lib.config.EnumRestartRequirement in project BuildCraft by BuildCraft.

the class BCEnergyConfig method preInit.

public static void preInit() {
    EnumRestartRequirement world = EnumRestartRequirement.WORLD;
    EnumRestartRequirement game = EnumRestartRequirement.GAME;
    propEnableOilGeneration = BCCoreConfig.config.get("worldgen", "enableOilGen", true);
    propEnableOilGeneration.setComment("Should any oil sprouts or lakes generate, at all?");
    game.setTo(propEnableOilGeneration);
    String[] _excessive = { // 
    BCEnergy.MODID + ":oil_desert", // 
    BCEnergy.MODID + ":oil_ocean" };
    propExcessiveBiomes = BCCoreConfig.config.get("worldgen", "excessiveBiomes", _excessive);
    propExcessiveBiomes.setComment("Biome registry names (e.g. 'minecraft:ocean','minecraft:plains')" + " of biomes that should have GREATLY increased oil generation rates.");
    world.setTo(propExcessiveBiomes);
    String[] _surface = {};
    propSurfaceDepositBiomes = BCCoreConfig.config.get("worldgen", "surfaceDepositBiomes", _surface);
    propSurfaceDepositBiomes.setComment("Biome registry names (e.g. 'minecraft:ocean','minecraft:hills')" + " of biomes that should have slightly increased oil generation rates.");
    world.setTo(propSurfaceDepositBiomes);
    String[] _excluded = { // 
    "minecraft:hell", // 
    "minecraft:sky" };
    propExcludedBiomes = BCCoreConfig.config.get("worldgen", "excludedBiomes", _excluded);
    propExcludedBiomes.setComment("Biome registry names (e.g. 'minecraft:hell','minecraft:jungle')" + " of biomes that should never generate oil.");
    world.setTo(propExcludedBiomes);
    int[] _dims = { -1, 1 };
    propExcludedDimensions = BCCoreConfig.config.get("worldgen", "excludedDimensions", _dims);
    propExcludedDimensions.setComment("Dimension ID's (e.g. '-1' for the nether,'1' for the end)" + " of dimensions that should never generate oil.");
    world.setTo(propExcludedDimensions);
    propChristmasEventType = BCCoreConfig.config.get("events", "christmas_chocolate", SpecialEventType.DAY_ONLY.lowerCaseName);
    ConfigUtil.setEnumProperty(propChristmasEventType, SpecialEventType.values());
    game.setTo(propChristmasEventType);
    reloadConfig(EnumRestartRequirement.GAME);
    BCCoreConfig.addReloadListener(BCEnergyConfig::reloadConfig);
}
Also used : EnumRestartRequirement(buildcraft.lib.config.EnumRestartRequirement)

Example 3 with EnumRestartRequirement

use of buildcraft.lib.config.EnumRestartRequirement in project BuildCraft by BuildCraft.

the class BCTransportConfig method onConfigChange.

@SubscribeEvent
public static void onConfigChange(OnConfigChangedEvent cce) {
    if (BCModules.isBcMod(cce.getModID())) {
        EnumRestartRequirement req = EnumRestartRequirement.NONE;
        if (Loader.instance().isInState(LoaderState.AVAILABLE)) {
            // The loaders state will be LoaderState.SERVER_STARTED when we are in a world
            req = EnumRestartRequirement.WORLD;
        }
        reloadConfig(req);
    }
}
Also used : EnumRestartRequirement(buildcraft.lib.config.EnumRestartRequirement) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 4 with EnumRestartRequirement

use of buildcraft.lib.config.EnumRestartRequirement in project BuildCraft by BuildCraft.

the class BCCoreConfig method preInit.

public static void preInit(File cfgFolder) {
    config = new Configuration(new File(cfgFolder, "main.cfg"));
    objConfig = RegistryConfig.setRegistryConfig(BCCore.MODID, new File(cfgFolder, "objects.cfg"));
    BCLibConfig.guiConfigFile = new File(cfgFolder, "gui.json");
    detailedConfigManager = new FileConfigManager(" The buildcraft detailed configuration file. This contains a lot of miscellaneous options that have no " + "affect on gameplay.\n You should refer to the BC source code for a detailed description of what these do. (https://github.com/BuildCraft/BuildCraft)\n" + " This file will be overwritten every time that buildcraft starts, so don't change anything other than the values.");
    detailedConfigManager.setConfigFile(new File(cfgFolder, "detailed.properties"));
    // Variables to make
    String general = Configuration.CATEGORY_GENERAL;
    String display = "display";
    String worldgen = "worldgen";
    String performance = "performance";
    EnumRestartRequirement none = EnumRestartRequirement.NONE;
    EnumRestartRequirement world = EnumRestartRequirement.WORLD;
    EnumRestartRequirement game = EnumRestartRequirement.GAME;
    propColourBlindMode = config.get(display, "colorBlindMode", false);
    propColourBlindMode.setComment("Should I enable colorblind mode?");
    none.setTo(propColourBlindMode);
    propWorldGen = config.get(worldgen, "enable", true);
    propWorldGen.setComment("Should BuildCraft generate anything in the world?");
    game.setTo(propWorldGen);
    propWorldGenWaterSpring = config.get(worldgen, "generateWaterSprings", true);
    propWorldGenWaterSpring.setComment("Should BuildCraft generate water springs?");
    game.setTo(propWorldGenWaterSpring);
    propMinePlayerProtected = config.get(general, "miningBreaksPlayerProtectedBlocks", false);
    propMinePlayerProtected.setComment("Should BuildCraft miners be allowed to break blocks using player-specific protection?");
    none.setTo(propMinePlayerProtected);
    propUseColouredLabels = config.get(display, "useColouredLabels", true);
    propUseColouredLabels.setComment("Should colours be displayed as their own (or a similar) colour in tooltips?");
    none.setTo(propUseColouredLabels);
    propUseHighContrastColouredLabels = config.get(display, "useHighContrastColouredLabels", false);
    propUseHighContrastColouredLabels.setComment("Should colours displayed in tooltips use higher-contrast colours?");
    none.setTo(propUseHighContrastColouredLabels);
    propHidePower = config.get(display, "hidePowerValues", false);
    propHidePower.setComment("Should all power values (MJ, MJ/t) be hidden?");
    none.setTo(propHidePower);
    propHideFluid = config.get(display, "hideFluidValues", false);
    propHideFluid.setComment("Should all fluid values (Buckets, mB, mB/t) be hidden?");
    none.setTo(propHideFluid);
    propUseBucketsStatic = config.get(display, "useBucketsStatic", false);
    propUseBucketsStatic.setComment("Should static fluid values be displayed in terms of buckets rather than thousandths of a bucket? (B vs mB)");
    none.setTo(propUseBucketsStatic);
    propUseBucketsFlow = config.get(display, "useBucketsFlow", false);
    propUseBucketsFlow.setComment("Should flowing fluid values be displayed in terms of buckets per second rather than thousandths of a bucket per tick? (B/s vs mB/t)");
    none.setTo(propUseBucketsFlow);
    propUseLongLocalizedName = config.get(display, "useLongLocalizedName", false);
    propUseLongLocalizedName.setComment("Should localised strings be displayed in long or short form (10 mB / t vs 10 milli buckets per tick");
    none.setTo(propUseLongLocalizedName);
    propDisplayTimeGap = config.get(display, "timeGap", TimeGap.TICKS.name().toLowerCase(Locale.ROOT));
    propDisplayTimeGap.setComment("Should localised strings be displayed in terms of seconds (1 MJ/s) or ticks (20 MJ/t)");
    ConfigUtil.setEnumProperty(propDisplayTimeGap, TimeGap.values());
    none.setTo(propDisplayTimeGap);
    propUseSwappableSprites = config.get(display, "useSwappableSprites", true);
    propUseSwappableSprites.setComment("Disable this if you get texture errors with optifine. Disables some texture switching functionality " + "when changing config options such as colour blind mode.");
    game.setTo(propUseSwappableSprites);
    propEnableAnimatedSprites = config.get(performance, "enableAnimatedSprites", true);
    propEnableAnimatedSprites.setComment("Disable this if you get sub-standard framerates due to buildcraft's ~60 sprites animating every frame.");
    none.setTo(propEnableAnimatedSprites);
    propItemRenderRotation = config.get(display, "itemRenderRotation", RenderRotation.ENABLED.name().toLowerCase(Locale.ROOT));
    propItemRenderRotation.setComment("The rotation that items use when travelling through pipes. Set to 'enabled' for full rotation, " + "'disabled' for no rotation, or 'horizontals_only' to only rotate items when going horizontally.");
    ConfigUtil.setEnumProperty(propItemRenderRotation, RenderRotation.values());
    propChunkLoadLevel = config.get(general, "chunkLoadLevel", ChunkLoaderLevel.SELF_TILES.name().toLowerCase(Locale.ROOT));
    propChunkLoadLevel.setComment("");
    ConfigUtil.setEnumProperty(propChunkLoadLevel, ChunkLoaderLevel.values());
    world.setTo(propChunkLoadLevel);
    propItemLifespan = config.get(general, "itemLifespan", 60);
    propItemLifespan.setMinValue(5).setMaxValue(600);
    propItemLifespan.setComment("How long, in seconds, should items stay on the ground? (Vanilla = 300, default = 60)");
    none.setTo(propItemLifespan);
    propPumpsConsumeWater = config.get(general, "pumpsConsumeWater", false);
    propPumpsConsumeWater.setComment("Should pumps consume water? Enabling this will disable" + " minor optimisations, but work properly with finite water mods.");
    none.setTo(propPumpsConsumeWater);
    propMarkerMaxDistance = config.get(general, "markerMaxDistance", 64);
    propMarkerMaxDistance.setMinValue(16).setMaxValue(256);
    propMarkerMaxDistance.setComment("How far, in minecraft blocks, should markers (volume and path) reach?");
    none.setTo(propMarkerMaxDistance);
    propPumpMaxDistance = config.get(general, "pumpMaxDistance", 64);
    propPumpMaxDistance.setMinValue(16).setMaxValue(128);
    propPumpMaxDistance.setComment("How far, in minecraft blocks, should pumps reach in fluids?");
    none.setTo(propPumpMaxDistance);
    propNetworkUpdateRate = config.get(general, "updateFactor", networkUpdateRate);
    propNetworkUpdateRate.setMinValue(1).setMaxValue(100);
    propNetworkUpdateRate.setComment("How often, in ticks, should network update packets be sent? Increasing this might help network performance.");
    none.setTo(propNetworkUpdateRate);
    reloadConfig(game);
    addReloadListener(BCCoreConfig::reloadConfig);
    MinecraftForge.EVENT_BUS.register(BCCoreConfig.class);
}
Also used : FileConfigManager(buildcraft.lib.config.FileConfigManager) Configuration(net.minecraftforge.common.config.Configuration) EnumRestartRequirement(buildcraft.lib.config.EnumRestartRequirement) File(java.io.File)

Aggregations

EnumRestartRequirement (buildcraft.lib.config.EnumRestartRequirement)4 FileConfigManager (buildcraft.lib.config.FileConfigManager)1 File (java.io.File)1 Configuration (net.minecraftforge.common.config.Configuration)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1