Java 类net.minecraftforge.common.config.Configuration 实例源码
项目:minecraft-quiverbow
文件:SugarEngine.java
@Override
public void addProps(FMLPreInitializationEvent event, Configuration config)
{
this.Enabled = config.get(this.nameInternal, "Am I enabled? (default true)", true).getBoolean(true);
this.namePublic = config.get(this.nameInternal, "What's my name?", this.nameInternal).getString();
this.DmgMin = config.get(this.nameInternal, "What damage am I dealing, at least? (default 1)", 1).getInt();
this.DmgMax = config.get(this.nameInternal, "What damage am I dealing, tops? (default 3)", 3).getInt();
this.Speed = config.get(this.nameInternal, "How fast are my projectiles? (default 2.0 BPT (Blocks Per Tick))", 2.0).getDouble();
this.Kickback = (byte) config.get(this.nameInternal, "How hard do I kick the user back when firing? (default 1)", 1).getInt();
this.Spread = (float) config.get(this.nameInternal, "How accurate am I? (default 10 spread)", 10).getDouble();
this.isMobUsable = config.get(this.nameInternal, "Can I be used by QuiverMobs? (default true. They'll probably figure it out.)", true).getBoolean(true);
}
项目:Device-Mod-Apps
文件:ModConfig.java
public static void initConfig(File configFile) { // Gets called from preInit
try {
// Ensure that the config file exists
if (!configFile.exists()) configFile.createNewFile();
// Create the config object
config = new Configuration(configFile);
// Load config
config.load();
// Read props from config
Property debugModeProp = config.get(Configuration.CATEGORY_GENERAL, // What category will it be saved to, can be any string
"debug_mode", // Property name
"false", // Default value
"Enable the debug mode (useful for reporting issues)"); // Comment
DEBUG_MODE = debugModeProp.getBoolean(); // Get the boolean value, also set the property value to boolean
} catch (Exception e) {
// Failed reading/writing, just continue
} finally {
// Save props to config IF config changed
if (config.hasChanged()) config.save();
}
}
项目:morefurnaces
文件:Config.java
public static void init(File configFile)
{
Configuration config = new Configuration(configFile);
try
{
config.load();
for (FurnaceType type : FurnaceType.values())
{
int speed = config.get("General", type.name().toLowerCase() + "FurnaceSpeed", type.speed).getInt(type.speed);
float consumptionRate = (float) config.get("General", type.name().toLowerCase() + "FurnaceConsumptionRate", type.consumptionRate).getDouble(type.consumptionRate);
furanceSpeeds.put(type, speed);
consumptionRates.put(type, consumptionRate);
}
} finally
{
config.save();
}
}
项目:PurificatiMagicae
文件:PMConfig.java
public void setup(Configuration configFile)
{
genCrystalRock = loadCrystal(configFile, "Rock", new String[]{"-1", "1"}, false);
genCrystalSea = loadCrystal(configFile, "Sea", new String[]{"-1", "1"}, false);
genCrystalFlame = loadCrystal(configFile, "Flame", new String[]{"-1"}, true);
genCrystalAir = loadCrystal(configFile, "Air", new String[]{"-1", "1"}, false);
genCrystalVision = loadCrystal(configFile, "Vision", new String[]{"1"}, true);
genCrysagnetite = loadOre(configFile, "Crysagnetite", 15, 25, 1, 3, 1, 2, 0.1f, new String[]{"-1", "1"}, false);
genCrystallizedRedstone = loadOreOnOre(configFile, "Crystallized Redstone", 0, 16, 0.03f, new String[]{"-1", "1"}, false);
genCrystallizedGlowstone = loadOreOnOre(configFile, "Crystallized Glowstone", 4, 123, 0.03f, new String[]{"-1"}, true);
genLabSmall = loadStructure(configFile, "Small Laboratory", 0.0007f, 15, 256, new String[]{"-1", "1"}, false);
genLabMedium = loadStructure(configFile, "Medium Laboratory", 0.0007f, 15, 256, new String[]{"-1", "1"}, false);
genBrulantaFlower = loadGround(configFile, "Brulanta Flower", 3, 256, 0, 4, 0.1f, new String[]{"-1", "1"}, false);
debugMessages = configFile.getBoolean("Debug", GENERAL, false, "Enables or disables the debug logger.");
animateIfTabletPageTransition = configFile.getBoolean("Animate IF Tablet page transitions", CLIENT, true, "");
testItem = configFile.getBoolean("Test Item", CLIENT, false, "Enables or disables the test item made for messing with models.");
if (configFile.hasChanged())
configFile.save();
}
项目:minecraft-quiverbow
文件:Mortar_Arrow.java
@Override
public void addProps(FMLPreInitializationEvent event, Configuration config)
{
this.Enabled = config.get(this.nameInternal, "Am I enabled? (default true)", true).getBoolean(true);
this.namePublic = config.get(this.nameInternal, "What's my name?", this.nameInternal).getString();
this.DmgMin = config.get(this.nameInternal, "What damage are my arrows dealing, at least? (default 2)", 2).getInt();
this.DmgMax = config.get(this.nameInternal, "What damage are my arrows dealing, tops? (default 10)", 10).getInt();
this.Speed = config.get(this.nameInternal, "How fast are my projectiles? (default 1.5 BPT (Blocks Per Tick))", 1.5).getDouble();
this.Kickback = (byte) config.get(this.nameInternal, "How hard do I kick the user back when firing? (default 3)", 3).getInt();
this.Cooldown = config.get(this.nameInternal, "How long until I can fire again? (default 20 ticks)", 20).getInt();
this.isMobUsable = config.get(this.nameInternal, "Can I be used by QuiverMobs? (default true.)", true).getBoolean(true);
}
项目:DebugServerInfo
文件:DebugServerInfo.java
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
logger = event.getModLog();
config = new Configuration(event.getSuggestedConfigurationFile());
doConfig();
int id = 1; // Don't use 0, more easy debug.
snw = NetworkRegistry.INSTANCE.newSimpleChannel(MOD_ID);
snw.registerMessage(Request.Handler.class, Request.class, id++, Side.SERVER);
snw.registerMessage(Data.Handler.class, Data.class, id++, Side.CLIENT);
proxy.preInit();
}
项目:ProgressiveDifficulty
文件:PotionCloudModifier.java
private static void constructFromConfig(String ID,
Potion effect,
String enableKey,
String enableComment,
int maxLevelDefault,
int defaultDifficultyCost,
double defaultWeight,
List<DifficultyModifier> returns,
Configuration config) {
Property modifierEnabledProp = config.get(ID,
enableKey, true, enableComment);
boolean modifierEnabled = modifierEnabledProp.getBoolean();
Property MaxLevelProp = config.get(ID,
"ModifierMaxLevel", maxLevelDefault, "Maximum level of this effect added to the target player when entering the cloud.");
int maxLevel = MaxLevelProp.getInt();
Property difficultyCostPerLevelProp = config.get(ID,
"DifficultyCostPerLevel", defaultDifficultyCost, "Cost of each level of the effect applied to the target player.");
int diffCostPerLevel = difficultyCostPerLevelProp.getInt();
Property selectionWeightProp = config.get(ID,
"ModifierWeight", defaultWeight, "Weight that affects how often this modifier is selected.");
double selectionWeight = selectionWeightProp.getDouble();
if (modifierEnabled && maxLevel > 0 && diffCostPerLevel > 0 && selectionWeight > 0) {
returns.add(new PotionCloudModifier(effect, maxLevel, diffCostPerLevel, selectionWeight, ID));
}
}
项目:Industrial-Foregoing
文件:AnimalByproductRecolectorBlock.java
@Override
public void getMachineConfig() {
super.getMachineConfig();
sewageAdult = CustomConfiguration.config.getInt("sewageAdult", "machines" + Configuration.CATEGORY_SPLITTER + this.getRegistryName().getResourcePath().toString(), 15, 1, Integer.MAX_VALUE, "Sewage produced by an adult animal");
sewageBaby = CustomConfiguration.config.getInt("sewageBaby", "machines" + Configuration.CATEGORY_SPLITTER + this.getRegistryName().getResourcePath().toString(), 5, 1, Integer.MAX_VALUE, "Sewage produced by a baby animal");
maxSludgeOperation = CustomConfiguration.config.getInt("maxSludgeOperation", "machines" + Configuration.CATEGORY_SPLITTER + this.getRegistryName().getResourcePath().toString(), 150, 1, Integer.MAX_VALUE, "Max sludge produced in an operation");
}
项目:minecraft-quiverbow
文件:LapisCoil.java
@Override
public void addProps(FMLPreInitializationEvent event, Configuration config)
{
this.Enabled = config.get(this.nameInternal, "Am I enabled? (default true)", true).getBoolean(true);
this.namePublic = config.get(this.nameInternal, "What's my name?", this.nameInternal).getString();
this.DmgMin = config.get(this.nameInternal, "What damage am I dealing, at least? (default 1)", 1).getInt();
this.DmgMax = config.get(this.nameInternal, "What damage am I dealing, tops? (default 3)", 3).getInt();
this.Speed = config.get(this.nameInternal, "How fast are my projectiles? (default 2.5 BPT (Blocks Per Tick))", 2.5).getDouble();
this.Weakness_Strength = config.get(this.nameInternal, "How strong is my Weakness effect? (default 2)", 2).getInt();
this.Weakness_Duration = config.get(this.nameInternal, "How long does my Weakness effect last? (default 40 ticks)", 40).getInt();
this.Nausea_Duration = config.get(this.nameInternal, "How long does my Nausea effect last? (default 40 ticks)", 40).getInt();
this.Hunger_Strength = config.get(this.nameInternal, "How strong is my Hunger effect? (default 2)", 2).getInt();
this.Hunger_Duration = config.get(this.nameInternal, "How long does my Hunger effect last? (default 40 ticks)", 40).getInt();
this.isMobUsable = config.get(this.nameInternal, "Can I be used by QuiverMobs? (default true.)", true).getBoolean(true);
}
项目:openarch
文件:Config.java
public static void load(File file) {
Configuration cfg = new Configuration(file);
ARM_CYCLES_PER_TICK = cfg.get(
"arm", "cyclesPerTick", new int[]{1000, 5000, 25000},
"CPU cycles per Minecraft tick. Default values: 1000, 5000, 25000 (20 kHz, 100 kHz, 500 kHz)",
1, Config.ARM_MAX_CYCLES_PER_TICK, true, 3).getIntList();
ARM_MAX_MEMORY = cfg.get(
"arm", "maxMemory", 4 * 1024 * 1024,
"Max memory allowed to be used by CPU. Default value: 4 MiB",
0, Config.ARM_MAX_MAX_MEMORY).getInt();
if (cfg.hasChanged()) {
cfg.save();
}
}
项目:MobBlocker
文件:Config.java
/**
* Accesses config field from CommonProxy and loads data to the static fields in this class
*/
public static void readConfig() {
Configuration cfg = CommonProxy.config;
try {
cfg.load();
initGeneralConfig(cfg);
initProtectionConfig(cfg);
initAreaProtConfig(cfg);
} catch (Exception exception) {
MobBlocker.logger.log(Level.ERROR, "Problem loading config file!", exception);
} finally {
if (cfg.hasChanged()) {
cfg.save();
}
}
}
项目:TFCPrimitiveTech
文件:ModOptions.java
public static int getIntFor(Configuration config,String heading, String item, int value, String comment)
{
if (config == null)
return value;
try
{
Property prop = config.get(heading, item, value);
prop.comment = comment;
return prop.getInt(value);
}
catch (Exception e)
{
System.out.println("[" + ModDetails.ModName + "] Error while trying to add Integer, config wasn't loaded properly!");
}
return value;
}
项目:PurificatiMagicae
文件:PMConfig.java
private ConfigOregenEntry loadOre(Configuration config, String name, int minY, int maxY, int minVs, int maxVs, int minVeins, int maxVeins, float chance, String[] dimList, boolean dimListMode)
{
ConfigOregenEntry entr = new ConfigOregenEntry();
entr.generate = config.getBoolean(name, WORLD, true, "");
entr.minY = config.getInt(name + " Min Y", WORLD, minY, 0, Integer.MAX_VALUE, "");
entr.maxY = config.getInt(name + " Max Y", WORLD, maxY, 0, Integer.MAX_VALUE, "");
entr.minVeinSize = config.getInt(name + " Min Vein Size", WORLD, minVs, 0, Integer.MAX_VALUE, "");
entr.maxVeinSize = config.getInt(name + " Max Vein Size", WORLD, maxVs, 0, Integer.MAX_VALUE, "");
entr.minVeins = config.getInt(name + " Min Veins Per Chunk", WORLD, minVeins, 0, Integer.MAX_VALUE, "");
entr.maxVeins = config.getInt(name + " Max Veins Per Chunk", WORLD, maxVeins, 0, Integer.MAX_VALUE, "");
entr.chance = config.getFloat(name + " Generation Chance", WORLD, chance, 0, 1, "");
entr.dimList = loadIntList(config, name + " DimList", WORLD, dimList, "");
entr.dimListMode = config.getBoolean(name + " DimList Mode", WORLD, dimListMode, "True = whitelist; False = blacklist");
return entr;
}
项目:TrustCircle
文件:TrustCircle.java
public static void defineConfigValues(){
maxRange = config.get(Configuration.CATEGORY_GENERAL, "maxRange", 8D, "The maximum distance a player can be away from another for the trust effect to take place", 1D, 50D).getDouble();
updateInterval = config.get(Configuration.CATEGORY_GENERAL, "updateInterval", 20, "The amount of ticks between updates and reapplication of the potion effect", 1, 100).getInt();
allowMultiplePlayers = config.get(Configuration.CATEGORY_GENERAL, "allowMultiplePlayers", true, "If multiple players can influence the strength of the trust effect").getBoolean();
baseCalcModifier = config.get(Configuration.CATEGORY_GENERAL, "baseCalcModifier", 5D, "The modifier used to determine both the duration and the amplifier of the effect", 0D, 100D).getDouble();
durationModifier = config.get(Configuration.CATEGORY_GENERAL, "durationModifier", 50D, "The modifier used to determine the duration of the effect", 0D, 500D).getDouble();
amplifierModifier = config.get(Configuration.CATEGORY_GENERAL, "amplifierModifier", 0.5D, "The modifier used to determine the amplifier of the effect", 0D, 100D).getDouble();
baseStrength = config.get(Configuration.CATEGORY_GENERAL, "baseStrength", 1D, "The base strength effect that will be applied through the trust potion effect, set to 0 to disable", 0D, 10D).getDouble();
baseRegen = (float)config.get(Configuration.CATEGORY_GENERAL, "baseRegen", 0.75D, "The base regen effect that will be applied through the trust potion effect, set to 0 to disable", 0D, 10D).getDouble();
isTeamDependent = config.get(Configuration.CATEGORY_GENERAL, "isTeamDependent", true, "If the trust effect will only be given to players that are in the same scoreboard team").getBoolean();
trustWithoutTeam = config.get(Configuration.CATEGORY_GENERAL, "trustWithoutTeam", true, "If players that are in no scoreboard team at all will also get the effect").getBoolean();
if(config.hasChanged()){
config.save();
}
}
项目:LagGoggles
文件:ConfigData.java
static Configuration getConfiguration() {
if (configuration == null) {
try {
final String fileName = Main.MODID_LOWER + ".cfg";
@SuppressWarnings("unchecked")
final Map<String, Configuration> configsMap = (Map<String, Configuration>) CONFIGS_GETTER.invokeExact();
final Optional<Map.Entry<String, Configuration>> entryOptional = configsMap.entrySet().stream()
.filter(entry -> fileName.equals(new File(entry.getKey()).getName()))
.findFirst();
if (entryOptional.isPresent()) {
configuration = entryOptional.get().getValue();
}
} catch (Throwable e) {
Main.LOGGER.error("Failed to get Configuration instance", e);
}
}
return configuration;
}
项目:minecraft-quiverbow
文件:DragonBox_Quad.java
@Override
public void addProps(FMLPreInitializationEvent event, Configuration config)
{
this.Enabled = config.get(this.nameInternal, "Am I enabled? (default true)", true).getBoolean(true);
this.namePublic = config.get(this.nameInternal, "What's my name?", this.nameInternal).getString();
this.DmgMin = config.get(this.nameInternal, "What damage am I dealing, at least? (default 4)", 4).getInt();
this.DmgMax = config.get(this.nameInternal, "What damage am I dealing, tops? (default 6)", 6).getInt();
this.Speed = config.get(this.nameInternal, "How fast are my projectiles? (default 1.3 BPT (Blocks Per Tick))", 1.3).getDouble();
this.Knockback = config.get(this.nameInternal, "How hard do I knock the target back when firing? (default 2)", 2).getInt();
this.Kickback = (byte) config.get(this.nameInternal, "How hard do I kick the user back when firing? (default 1)", 1).getInt();
this.Cooldown = config.get(this.nameInternal, "How long until I can fire again? (default 10 ticks)", 10).getInt();
this.FireDur = config.get(this.nameInternal, "How long is what I hit on fire? (default 6s)", 6).getInt();
this.ExplosionSize = config.get(this.nameInternal, "How big are my explosions? (default 1.0 blocks, for no terrain damage. TNT is 4.0 blocks)", 1.0).getDouble();
this.dmgTerrain = config.get(this.nameInternal, "Can I damage terrain, when in player hands? (default true)", true).getBoolean(true);
this.isMobUsable = config.get(this.nameInternal, "Can I be used by QuiverMobs? (default false. A bit too high-power for them.)", false).getBoolean();
}
项目:minecraft-quiverbow
文件:ERA.java
@Override
public void addProps(FMLPreInitializationEvent event, Configuration config)
{
this.Enabled = config.get(this.nameInternal, "Am I enabled? (default true)", true).getBoolean(true);
this.namePublic = config.get(this.nameInternal, "What's my name?", this.nameInternal).getString();
this.DmgMin = config.get(this.nameInternal, "What damage am I dealing with a direct hit, at least? (default 120)", 120).getInt();
this.DmgMax = config.get(this.nameInternal, "What damage am I dealing with a direct hit, tops? (default 150)", 150).getInt();
this.explosionSelf = config.get(this.nameInternal, "How big are my explosions when leaving the barrel? (default 4.0 blocks. TNT is 4.0 blocks)", 4.0).getDouble();
this.explosionTarget = config.get(this.nameInternal, "How big are my explosions when hitting a target? (default 8.0 blocks. TNT is 4.0 blocks)", 8.0).getDouble();
this.Kickback = (byte) config.get(this.nameInternal, "How hard do I kick the user back when firing? (default 30)", 30).getInt();
this.dmgTerrain = config.get(this.nameInternal, "Can I damage terrain, when in player hands? (default true)", true).getBoolean(true);
this.isMobUsable = config.get(this.nameInternal, "Can I be used by QuiverMobs? (default false. Too high-power and suicidal.)", false).getBoolean();
}
项目:BetterThanWeagles
文件:Config.java
public static void readConfig()
{
Configuration cfg = CommonProxy.config;
try
{
cfg.load();
initGeneralConfig(cfg);
initFoodConfig(cfg);
initJellyBeanConfig(cfg);
}
catch (Exception e)
{
BetterThanWeagles.logger.log(Level.ERROR, "Problem loading config file!", e);
}
finally
{
if (cfg.hasChanged())
{
cfg.save();
}
}
}
项目:TFCPrimitiveTech
文件:ModOptions.java
public static double getDoubleFor(Configuration config,String heading, String item, double value, String comment)
{
if (config == null)
return value;
try
{
Property prop = config.get(heading, item, value);
prop.comment = comment;
return prop.getDouble(value);
}
catch (Exception e)
{
System.out.println("[" + ModDetails.ModName + "] Error while trying to add Double, config wasn't loaded properly!");
}
return value;
}
项目:UHC-Compass
文件:UHCCompass.java
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event){
config = new Configuration(event.getSuggestedConfigurationFile());
config.load();
COMPASSX_PROPERTY = config.get("hidden", ConfigValues.COMPASSX_NAME, ConfigValues.COMPASSX_DEFAULT, I18n.format(ConfigValues.COMPASSX_NAME+".tooltip"));
COMPASSY_PROPERTY = config.get("hidden", ConfigValues.COMPASSY_NAME, ConfigValues.COMPASSY_DEFAULT, I18n.format(ConfigValues.COMPASSY_NAME+".tooltip"));
TARGETX_PROPERTY = config.get(Configuration.CATEGORY_GENERAL, ConfigValues.TARGETX_NAME, ConfigValues.TARGETX_DEFAULT, I18n.format(ConfigValues.TARGETX_NAME+".tooltip"));
TARGETZ_PROPERTY = config.get(Configuration.CATEGORY_GENERAL, ConfigValues.TARGETZ_NAME, ConfigValues.TARGETZ_DEFAULT, I18n.format(ConfigValues.TARGETZ_NAME+".tooltip"));
XALIGNMENT_PROPERTY = config.get("hidden", ConfigValues.XALIGNMENT_NAME, ConfigValues.XALIGNMENT_DEFAULT.name(), I18n.format(ConfigValues.XALIGNMENT_NAME+".tooltip"));
YALIGNMENT_PROPERTY = config.get("hidden", ConfigValues.YALIGNMENT_NAME, ConfigValues.YALIGNMENT_DEFAULT.name(), I18n.format(ConfigValues.YALIGNMENT_NAME+".tooltip"));
syncConfig();
GameRegistry.register(uhccompass);
ModelLoader.setCustomModelResourceLocation(uhccompass, 0, new ModelResourceLocation(MODID+":uhccompass", "inventory"));
MinecraftForge.EVENT_BUS.register(new ClientEvents());
MinecraftForge.EVENT_BUS.register(new RenderEvents());
MinecraftForge.EVENT_BUS.register(keyHandler = new KeyHandler());
}
项目:Etheric
文件:Config.java
private static void initGeneralConfig(Configuration cfg) {
cfg.addCustomCategoryComment(CATEGORY_GENERAL, "General Options");
cfg.addCustomCategoryComment(CATEGORY_WORLD, "World Generation Options");
LODESTONE_FREQUENCY = cfg.getInt("Lodestone Frequency", CATEGORY_WORLD, 4, 0, 64, "Number of lodestone veins per chunk");
LODESTONE_VEIN_SIZE = cfg.getInt("Lodestone Vein Size", CATEGORY_WORLD, 5, 0, 64, "Blocks per lodestone vein");
LODESTONE_MIN_Y = cfg.getInt("Lodestone Min Y", CATEGORY_WORLD, 0, 0, 256, "Minimum y value where lodestone veins can spawn");
LODESTONE_MAX_Y = cfg.getInt("Lodestone Max Y", CATEGORY_WORLD, 40, 0, 256, "Maximum y value where lodestone veins can spawn");
RIFT_FREQUENCY = cfg.getInt("Rift Frequency", CATEGORY_WORLD, 16, 0, 1024, "How common rifts are in worldgen.\nA rift will spawn in 1 in every x chunks with a low enough stability value.");
PROPERTY_ORDER_WORLD.add("Lodestone Frequency");
PROPERTY_ORDER_WORLD.add("Lodestone Vein Size");
PROPERTY_ORDER_WORLD.add("Lodestone Min Y");
PROPERTY_ORDER_WORLD.add("Lodestone Max Y");
PROPERTY_ORDER_WORLD.add("Rift Frequency");
cfg.setCategoryPropertyOrder(CATEGORY_GENERAL, PROPERTY_ORDER_GENERAL);
cfg.setCategoryPropertyOrder(CATEGORY_WORLD, PROPERTY_ORDER_WORLD);
}
项目:MeeCreeps
文件:CommonProxy.java
public void preInit(FMLPreInitializationEvent e) {
MinecraftForge.EVENT_BUS.register(new ForgeEventHandlers());
McJtyLib.preInit(e);
CommandHandler.registerCommands();
MeeCreeps.api.registerFactories();
File directory = e.getModConfigurationDirectory();
config = new Configuration(new File(directory.getPath(), "meecreeps.cfg"));
Config.readConfig();
SimpleNetworkWrapper network = mcjty.lib.network.PacketHandler.registerMessages(MeeCreeps.MODID, "meecreeps");
MeeCreepsMessages.registerMessages(network);
// Initialization of blocks and items typically goes here:
ModEntities.init();
}
项目:minecraft-quiverbow
文件:OSR.java
@Override
public void addProps(FMLPreInitializationEvent event, Configuration config)
{
this.Enabled = config.get(this.nameInternal, "Am I enabled? (default true)", true).getBoolean(true);
this.namePublic = config.get(this.nameInternal, "What's my name?", this.nameInternal).getString();
this.DmgMin = config.get(this.nameInternal, "What damage am I dealing, at least? (default 7)", 7).getInt();
this.DmgMax = config.get(this.nameInternal, "What damage am I dealing, tops? (default 13)", 13).getInt();
this.Speed = config.get(this.nameInternal, "How fast are my projectiles? (default 3.0 BPT (Blocks Per Tick))", 3.0).getDouble();
this.Knockback = config.get(this.nameInternal, "How hard do I knock the target back when firing? (default 2)", 2).getInt();
this.Kickback = (byte) config.get(this.nameInternal, "How hard do I kick the user back when firing? (default 4)", 4).getInt();
this.Cooldown = config.get(this.nameInternal, "How long until I can fire again? (default 100 ticks)", 100).getInt();
this.Wither_Strength = config.get(this.nameInternal, "How strong is my Wither effect? (default 3)", 3).getInt();
this.Wither_Duration = config.get(this.nameInternal, "How long does my Wither effect last? (default 61 ticks)", 61).getInt();
this.isMobUsable = config.get(this.nameInternal, "Can I be used by QuiverMobs? (default true.)", true).getBoolean(true);
}
项目:minecraft-quiverbow
文件:OSP.java
@Override
public void addProps(FMLPreInitializationEvent event, Configuration config)
{
this.Enabled = config.get(this.nameInternal, "Am I enabled? (default true)", true).getBoolean(true);
this.namePublic = config.get(this.nameInternal, "What's my name?", this.nameInternal).getString();
this.DmgMin = config.get(this.nameInternal, "What damage am I dealing, at least? (default 4)", 4).getInt();
this.DmgMax = config.get(this.nameInternal, "What damage am I dealing, tops? (default 8)", 8).getInt();
this.Speed = config.get(this.nameInternal, "How fast are my projectiles? (default 1.7 BPT (Blocks Per Tick))", 1.7).getDouble();
this.Cooldown = config.get(this.nameInternal, "How long until I can fire again? (default 15 ticks)", 15).getInt();
this.Wither_Strength = config.get(this.nameInternal, "How strong is my Wither effect? (default 1)", 1).getInt();
this.Wither_Duration = config.get(this.nameInternal, "How long does my Wither effect last? (default 61 ticks)", 61).getInt();
this.isMobUsable = config.get(this.nameInternal, "Can I be used by QuiverMobs? (default true.)", true).getBoolean(true);
}
项目:minecraft-quiverbow
文件:Sunray.java
@Override
public void addProps(FMLPreInitializationEvent event, Configuration config)
{
this.Enabled = config.get(this.nameInternal, "Am I enabled? (default true)", true).getBoolean(true);
this.namePublic = config.get(this.nameInternal, "What's my name?", this.nameInternal).getString();
this.DmgMin = config.get(this.nameInternal, "What damage are my arrows dealing, at least? (default 14)", 14).getInt();
this.DmgMax = config.get(this.nameInternal, "What damage are my arrows dealing, tops? (default 20)", 20).getInt();
this.Speed = 4.0f;
this.Kickback = (byte) config.get(this.nameInternal, "How hard do I kick the user back when firing? (default 3)", 3).getInt();
this.Cooldown = config.get(this.nameInternal, "How long until I can fire again? (default 120 ticks)", 120).getInt();
this.FireDur = config.get(this.nameInternal, "How long is what I hit on fire? (default 10s)", 10).getInt();
this.MaxTicks = config.get(this.nameInternal, "How long does my beam exist, tops? (default 60 ticks)", 60).getInt();
this.LightMin = config.get(this.nameInternal, "What light level do I need to recharge, at least? (default 12)", 12).getInt();
this.isMobUsable = config.get(this.nameInternal, "Can I be used by QuiverMobs? (default false. Too damn bright for their taste.)", false).getBoolean();
}
项目:ProgressiveDifficulty
文件:Region.java
public void readConfig(){
File regionFolder = new File(DifficultyManager.getConfigDir(),getName());
File regionConfigFile = new File(regionFolder,"region.cfg");
File defaultRegionConfigFile = new File(regionFolder,"default.cfg");
File[] filesInRegion = regionFolder.listFiles();
List<File> mobConfigFiles = Lists.newArrayList();
if(filesInRegion!=null) {
mobConfigFiles.addAll(Arrays.stream(filesInRegion)
.filter(
file -> {
return !(file.getName().endsWith("region.cfg") || file.getName().endsWith("default.cfg"));
}).collect(Collectors.toList()));
}
Configuration regionConfig = new Configuration(regionConfigFile);
readRegionConfig(regionConfig);
Configuration defaultConfiguration = new Configuration(defaultRegionConfigFile);
try {
defaultConfiguration.load();
defaultConfig = new RegionMobConfig(defaultConfiguration);
}finally {
if(defaultConfiguration.hasChanged()){
defaultConfiguration.save();
}
}
for(File mobConfigFile : mobConfigFiles){
String mobId = mobConfigFile.getName();
mobId = mobId.substring(0,mobId.lastIndexOf("."));
Configuration config = new Configuration(mobConfigFile);
try {
config.load();
RegionMobConfig mobConfig = new RegionMobConfig(config);
byMobConfig.put(mobId,mobConfig);
}finally {
if(config.hasChanged()){
config.save();
}
}
}
}
项目:CustomWorldGen
文件:ForgeGuiFactory.java
@Override
protected GuiScreen buildChildScreen()
{
// This GuiConfig object specifies the configID of the object and as such will force-save when it is closed. The parent
// GuiConfig object's entryList will also be refreshed to reflect the changes.
return new GuiConfig(this.owningScreen,
(new ConfigElement(ForgeModContainer.getConfig().getCategory(Configuration.CATEGORY_CLIENT))).getChildElements(),
this.owningScreen.modID, Configuration.CATEGORY_CLIENT, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart,
GuiConfig.getAbridgedConfigPath(ForgeModContainer.getConfig().toString()));
}
项目:ProgressiveDifficulty
文件:Region.java
public RegionMobConfig(Configuration config){
for(DifficultyModifier modifier : DifficultyManager.buildModifiersFromConfig(config)){
modifiers.put(modifier.getIdentifier(),modifier);
}
controls.addAll(DifficultyManager.buildControlsFromConfig(config));
generateWeightMap();
}
项目:BetterBeginningsReborn
文件:BBConfig.java
public static void save(Configuration config)
{
if (config.hasChanged())
{
config.save();
}
}
项目:minecraft-quiverbow
文件:RPG.java
@Override
public void addProps(FMLPreInitializationEvent event, Configuration config)
{
this.Enabled = config.get(this.nameInternal, "Am I enabled? (default true)", true).getBoolean(true);
this.namePublic = config.get(this.nameInternal, "What's my name?", this.nameInternal).getString();
this.Speed = config.get(this.nameInternal, "How fast are my projectiles? (default 2.0 BPT (Blocks Per Tick))", 2.0).getDouble();
this.Kickback = (byte) config.get(this.nameInternal, "How hard do I kick the user back when firing? (default 3)", 3).getInt();
this.ExplosionSize = config.get(this.nameInternal, "How big are my explosions? (default 4.0 blocks, like TNT)", 4.0).getDouble();
this.travelTime = config.get(this.nameInternal, "How many ticks can my rocket fly before exploding? (default 20 ticks)", 20).getInt();
this.dmgTerrain = config.get(this.nameInternal, "Can I damage terrain, when in player hands? (default true)", true).getBoolean(true);
this.isMobUsable = config.get(this.nameInternal, "Can I be used by QuiverMobs? (default true)", true).getBoolean(true);
}
项目:youtube-chat-for-minecraft
文件:YouTubeConfiguration.java
private YouTubeConfiguration(File path) {
config = new Configuration(path);
config.load();
addGeneralConfig();
if (config.hasChanged()) {
config.save();
}
}
项目:minecraft-quiverbow
文件:RedSprayer.java
@Override
public void addProps(FMLPreInitializationEvent event, Configuration config)
{
this.Enabled = config.get(this.nameInternal, "Am I enabled? (default true)", true).getBoolean(true);
this.namePublic = config.get(this.nameInternal, "What's my name?", this.nameInternal).getString();
this.Speed = config.get(this.nameInternal, "How fast are my projectiles? (default 0.5 BPT (Blocks Per Tick))", 0.5).getDouble();
this.Wither_Strength = config.get(this.nameInternal, "How strong is my Wither effect? (default 2)", 2).getInt();
this.Wither_Duration = config.get(this.nameInternal, "How long does my Wither effect last? (default 20 ticks)", 20).getInt();
this.Blindness_Duration = config.get(this.nameInternal, "How long does my Blindness effect last? (default 20 ticks)", 20).getInt();
this.isMobUsable = config.get(this.nameInternal, "Can I be used by QuiverMobs? (default true)", true).getBoolean(true);
}
项目:minecraft-quiverbow
文件:NetherBellows.java
@Override
public void addProps(FMLPreInitializationEvent event, Configuration config)
{
this.Enabled = config.get(this.nameInternal, "Am I enabled? (default true)", true).getBoolean(true);
this.namePublic = config.get(this.nameInternal, "What's my name?", this.nameInternal).getString();
this.Speed = config.get(this.nameInternal, "How fast are my projectiles? (default 0.75 BPT (Blocks Per Tick))", 0.75).getDouble();
this.Dmg = config.get(this.nameInternal, "What damage am I dealing per projectile? (default 1)", 1).getInt();
this.FireDur = config.get(this.nameInternal, "For how long do I set things on fire? (default 3 sec)", 3).getInt();
this.isMobUsable = config.get(this.nameInternal, "Can I be used by QuiverMobs? (default true.)", true).getBoolean(true);
}
项目:Industrial-Foregoing
文件:CropRecolectorBlock.java
@Override
public void getMachineConfig() {
super.getMachineConfig();
sludgeOperation = CustomConfiguration.config.getInt("sludgeOperation", "machines" + Configuration.CATEGORY_SPLITTER + this.getRegistryName().getResourcePath().toString(), 20, 1, 8000, "How much sludge is produced when the machine does an operation");
treeOperations = CustomConfiguration.config.getInt("treeOperations", "machines" + Configuration.CATEGORY_SPLITTER + this.getRegistryName().getResourcePath().toString(), 10, 1, 1024, "Amount of operations done when chopping a tree");
reducedChunkUpdates = CustomConfiguration.config.getBoolean("reducedChunkUpdates", "machines" + Configuration.CATEGORY_SPLITTER + this.getRegistryName().getResourcePath().toString(), false, "When enabled it will chop down the tree in one go but still consuming the same power");
}
项目:Whoosh
文件:Whoosh.java
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
CONFIG.setConfiguration(new Configuration(new File(CoreProps.configDir, MOD_ID + "/common.cfg"), true));
CONFIG_CLIENT.setConfiguration(new Configuration(new File(CoreProps.configDir, MOD_ID + "/client.cfg"), true));
WProps.preInit();
WItems.preInit();
PacketHandler.INSTANCE.registerPacket(PacketWhoosh.class);
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
proxy.preInit(event);
}
项目:TFCPrimitiveTech
文件:ModOptions.java
public static int getIntFor(Configuration config, String heading, String item, int value)
{
if (config == null)
return value;
try
{
Property prop = config.get(heading, item, value);
return prop.getInt(value);
}
catch (Exception e)
{
System.out.println("[" + ModDetails.ModName + "] Error while trying to add Integer, config wasn't loaded properly!");
}
return value;
}
项目:EndermanEvolution
文件:GuiModConfig.java
private static List<IConfigElement> getConfigElements() {
List<IConfigElement> configElements = new ArrayList<IConfigElement>();
Configuration config = ModConfig.CONFIG;
if (config != null) {
ConfigCategory categoryClient = config.getCategory(ModConfig.CLIENT_CAT);
configElements.addAll(new ConfigElement(categoryClient).getChildElements());
}
return configElements;
}
项目:PurificatiMagicae
文件:PMConfig.java
private List<Integer> loadIntList(Configuration configFile, String name, String category, String[] defaults, String descr)
{
String[] rcbld = configFile.getStringList(name, category, defaults, descr);
List<Integer> lst = new ArrayList<>();
for (String s : rcbld)
{
if (!StringUtils.isNullOrEmpty(s))
{
lst.add(Integer.parseInt(s));
}
}
return lst;
}
项目:TrustCircle
文件:TrustCircle.java
@EventHandler
public void preInit(FMLPreInitializationEvent event){
config = new Configuration(event.getSuggestedConfigurationFile());
config.load();
defineConfigValues();
potionTrust = new PotionTrust("trust");
MinecraftForge.EVENT_BUS.register(new Events());
}
项目:minecraft-quiverbow
文件:SoulCairn.java
@Override
public void addProps(FMLPreInitializationEvent event, Configuration config)
{
this.Enabled = config.get(this.nameInternal, "Am I enabled? (default true)", true).getBoolean(true);
this.namePublic = config.get(this.nameInternal, "What's my name?", this.nameInternal).getString();
this.Speed = config.get(this.nameInternal, "How fast are my projectiles? (default 3.0 BPT (Blocks Per Tick))", 3.0).getDouble();
this.Kickback = (byte) config.get(this.nameInternal, "How hard do I kick the user back when firing? (default 4)", 4).getInt();
this.isMobUsable = config.get(this.nameInternal, "Can I be used by QuiverMobs? (default false. This is easily abusable.)", false).getBoolean(true);
}