2014-11-14 12:02:52 +01:00
/ *
* This file is part of Applied Energistics 2 .
* Copyright ( c ) 2013 - 2014 , AlgorithmX2 , All rights reserved .
*
* Applied Energistics 2 is free software : you can redistribute it and / or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation , either version 3 of the License , or
* ( at your option ) any later version .
*
* Applied Energistics 2 is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU Lesser General Public License for more details .
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2 . If not , see < http : //www.gnu.org/licenses/lgpl>.
* /
2014-02-09 06:08:27 +01:00
package appeng.core ;
2014-11-28 04:36:46 +01:00
2014-02-09 06:08:27 +01:00
import java.io.File ;
2014-08-30 04:35:07 +02:00
import java.util.Arrays ;
2014-02-09 06:08:27 +01:00
import java.util.EnumSet ;
2014-08-30 04:35:07 +02:00
import java.util.List ;
2014-02-09 06:08:27 +01:00
import net.minecraftforge.common.config.Configuration ;
import net.minecraftforge.common.config.Property ;
2014-11-28 04:36:46 +01:00
import cpw.mods.fml.client.event.ConfigChangedEvent ;
import cpw.mods.fml.common.FMLCommonHandler ;
import cpw.mods.fml.common.ModContainer ;
import cpw.mods.fml.common.eventhandler.SubscribeEvent ;
2014-09-20 22:21:47 +02:00
import appeng.api.config.CondenserOutput ;
2014-02-09 06:08:27 +01:00
import appeng.api.config.PowerMultiplier ;
import appeng.api.config.PowerUnits ;
2014-02-16 10:09:20 +01:00
import appeng.api.config.SearchBoxMode ;
2014-02-09 06:08:27 +01:00
import appeng.api.config.Settings ;
2014-03-27 06:14:34 +01:00
import appeng.api.config.TerminalStyle ;
2014-02-09 06:08:27 +01:00
import appeng.api.config.YesNo ;
import appeng.api.util.IConfigManager ;
2014-09-20 22:20:00 +02:00
import appeng.api.util.IConfigurableObject ;
2014-02-09 06:08:27 +01:00
import appeng.core.features.AEFeature ;
2014-03-17 20:59:50 +01:00
import appeng.core.settings.TickRates ;
2014-08-03 01:09:41 +02:00
import appeng.items.materials.MaterialType ;
2014-02-09 06:08:27 +01:00
import appeng.util.ConfigManager ;
import appeng.util.IConfigManagerHost ;
2014-03-06 06:45:14 +01:00
import appeng.util.Platform ;
2014-02-09 06:08:27 +01:00
2014-09-20 22:20:00 +02:00
public class AEConfig extends Configuration implements IConfigurableObject , IConfigManagerHost
2014-02-09 06:08:27 +01:00
{
public static AEConfig instance ;
2015-01-01 22:13:10 +01:00
public static final double TUNNEL_POWER_LOSS = 0 . 05 ;
2014-02-09 06:08:27 +01:00
public String latestVersion = VERSION ;
public long latestTimeStamp = 0 ;
public static final String VERSION = " @version@ " ;
public static final String CHANNEL = " @aechannel@ " ;
public final static String PACKET_CHANNEL = " AE " ;
2014-09-29 09:54:34 +02:00
public final IConfigManager settings = new ConfigManager ( this ) ;
public final EnumSet < AEFeature > featureFlags = EnumSet . noneOf ( AEFeature . class ) ;
2014-03-06 06:45:14 +01:00
PowerUnits selectedPowerUnit = PowerUnits . AE ;
2014-02-09 06:08:27 +01:00
2014-03-05 08:27:42 +01:00
public int storageBiomeID = - 1 ;
public int storageProviderID = - 1 ;
2014-09-07 19:01:09 +02:00
public int formationPlaneEntityLimit = 128 ;
2014-03-15 07:58:21 +01:00
public float spawnChargedChance = 0 . 92f ;
public int quartzOresPerCluster = 4 ;
2014-08-15 18:04:55 +02:00
public int quartzOresClusterAmount = 15 ;
2014-03-15 07:58:21 +01:00
public int chargedChange = 4 ;
public int minMeteoriteDistance = 707 ;
2014-12-29 15:13:47 +01:00
public int minMeteoriteDistanceSq = this . minMeteoriteDistance * this . minMeteoriteDistance ;
2014-02-09 06:08:27 +01:00
private double WirelessBaseCost = 8 ;
private double WirelessCostMultiplier = 1 ;
2014-09-29 09:54:34 +02:00
private final double WirelessHighWirelessCount = 64 ;
2014-02-09 06:08:27 +01:00
private double WirelessTerminalDrainMultiplier = 1 ;
private double WirelessBaseRange = 16 ;
private double WirelessBoosterRangeMultiplier = 1 ;
private double WirelessBoosterExp = 1 . 5 ;
public double wireless_getDrainRate ( double range )
{
2014-12-29 15:13:47 +01:00
return this . WirelessTerminalDrainMultiplier * range ;
2014-02-09 06:08:27 +01:00
}
public double wireless_getMaxRange ( int boosters )
{
2014-12-29 15:13:47 +01:00
return this . WirelessBaseRange + this . WirelessBoosterRangeMultiplier * Math . pow ( boosters , this . WirelessBoosterExp ) ;
2014-02-09 06:08:27 +01:00
}
public double wireless_getPowerDrain ( int boosters )
{
2014-12-29 15:13:47 +01:00
return this . WirelessBaseCost + this . WirelessCostMultiplier * Math . pow ( boosters , 1 + boosters / this . WirelessHighWirelessCount ) ;
2014-02-09 06:08:27 +01:00
}
2014-07-25 06:59:58 +02:00
@Override
public Property get ( String category , String key , String defaultValue , String comment , Property . Type type )
{
Property prop = super . get ( category , key , defaultValue , comment , type ) ;
if ( prop ! = null )
{
if ( ! category . equals ( " Client " ) )
prop . setRequiresMcRestart ( true ) ;
}
return prop ;
}
2014-09-28 11:47:17 +02:00
public double spatialPowerExponent = 1 . 35 ;
2014-08-28 23:15:49 +02:00
public double spatialPowerMultiplier = 1250 . 0 ;
2014-02-09 06:08:27 +01:00
2015-01-01 21:15:03 +01:00
public String [ ] grinderOres = {
2014-02-09 06:08:27 +01:00
// Vanilla Items
2014-08-03 01:09:41 +02:00
" Obsidian " , " Ender " , " EnderPearl " , " Coal " , " Iron " , " Gold " , " Charcoal " , " NetherQuartz " ,
2014-02-09 06:08:27 +01:00
// Common Mod Ores
" Copper " , " Tin " , " Silver " , " Lead " , " Bronze " ,
// AE
" CertusQuartz " , " Wheat " , " Fluix " ,
// Other Mod Ores
2015-03-15 09:02:23 +01:00
" Brass " , " Platinum " , " Nickel " , " Invar " , " Aluminium " , " Electrum " , " Osmium " , " Zinc " } ;
2014-02-09 06:08:27 +01:00
public double oreDoublePercentage = 90 . 0 ;
public boolean enableEffects = true ;
2014-03-17 20:59:50 +01:00
public boolean useLargeFonts = false ;
2015-02-27 13:33:53 +01:00
public boolean useColoredCraftingStatus ;
2014-09-29 09:54:34 +02:00
public final int [ ] craftByStacks = new int [ ] { 1 , 10 , 100 , 1000 } ;
public final int [ ] priorityByStacks = new int [ ] { 1 , 10 , 100 , 1000 } ;
public final int [ ] levelByStacks = new int [ ] { 1 , 10 , 100 , 1000 } ;
2014-02-09 06:08:27 +01:00
2014-09-28 11:47:17 +02:00
public int wirelessTerminalBattery = 1600000 ;
public int entropyManipulatorBattery = 200000 ;
public int matterCannonBattery = 200000 ;
public int portableCellBattery = 20000 ;
public int colorApplicatorBattery = 20000 ;
public int chargedStaffBattery = 8000 ;
2014-02-09 06:08:27 +01:00
2014-07-26 02:31:12 +02:00
public boolean disableColoredCableRecipesInNEI = true ;
2014-09-20 23:32:40 +02:00
public boolean updatable = false ;
2014-07-25 06:59:58 +02:00
final private File myPath ;
2014-09-20 23:33:21 +02:00
public double meteoriteClusterChance = 0 . 1 ;
2014-09-20 23:33:44 +02:00
public double meteoriteSpawnChance = 0 . 3 ;
2014-10-19 02:32:51 +02:00
public int [ ] meteoriteDimensionWhitelist = new int [ ] { 0 } ;
2014-08-14 02:34:54 +02:00
2014-08-30 21:50:00 +02:00
public int craftingCalculationTimePerTick = 5 ;
2015-02-27 13:33:53 +01:00
2014-07-25 06:59:58 +02:00
@SubscribeEvent
public void onConfigChanged ( ConfigChangedEvent . OnConfigChangedEvent eventArgs )
{
2014-11-28 04:36:46 +01:00
if ( eventArgs . modID . equals ( AppEng . MOD_ID ) )
2014-07-25 06:59:58 +02:00
{
2014-12-29 15:13:47 +01:00
this . clientSync ( ) ;
2014-07-25 06:59:58 +02:00
}
}
private void clientSync ( )
{
2014-12-29 15:13:47 +01:00
this . disableColoredCableRecipesInNEI = this . get ( " Client " , " disableColoredCableRecipesInNEI " , true ) . getBoolean ( true ) ;
this . enableEffects = this . get ( " Client " , " enableEffects " , true ) . getBoolean ( true ) ;
this . useLargeFonts = this . get ( " Client " , " useTerminalUseLargeFont " , false ) . getBoolean ( false ) ;
2015-02-27 13:33:53 +01:00
this . useColoredCraftingStatus = this . get ( " Client " , " useColoredCraftingStatus " , true ) . getBoolean ( true ) ;
2014-07-25 06:59:58 +02:00
2014-07-31 19:24:08 +02:00
// load buttons..
for ( int btnNum = 0 ; btnNum < 4 ; btnNum + + )
{
2014-12-29 15:13:47 +01:00
Property cmb = this . get ( " Client " , " craftAmtButton " + ( btnNum + 1 ) , this . craftByStacks [ btnNum ] ) ;
Property pmb = this . get ( " Client " , " priorityAmtButton " + ( btnNum + 1 ) , this . priorityByStacks [ btnNum ] ) ;
Property lmb = this . get ( " Client " , " levelAmtButton " + ( btnNum + 1 ) , this . levelByStacks [ btnNum ] ) ;
2014-07-31 19:24:08 +02:00
int buttonCap = ( int ) ( Math . pow ( 10 , btnNum + 1 ) - 1 ) ;
2014-12-29 15:13:47 +01:00
this . craftByStacks [ btnNum ] = Math . abs ( cmb . getInt ( this . craftByStacks [ btnNum ] ) ) ;
this . priorityByStacks [ btnNum ] = Math . abs ( pmb . getInt ( this . priorityByStacks [ btnNum ] ) ) ;
this . levelByStacks [ btnNum ] = Math . abs ( pmb . getInt ( this . levelByStacks [ btnNum ] ) ) ;
2014-07-31 19:24:08 +02:00
cmb . comment = " Controls buttons on Crafting Screen : Capped at " + buttonCap ;
pmb . comment = " Controls buttons on Priority Screen : Capped at " + buttonCap ;
2014-08-01 03:59:24 +02:00
lmb . comment = " Controls buttons on Level Emitter Screen : Capped at " + buttonCap ;
2014-07-31 19:24:08 +02:00
2014-12-29 15:13:47 +01:00
this . craftByStacks [ btnNum ] = Math . min ( this . craftByStacks [ btnNum ] , buttonCap ) ;
this . priorityByStacks [ btnNum ] = Math . min ( this . priorityByStacks [ btnNum ] , buttonCap ) ;
this . levelByStacks [ btnNum ] = Math . min ( this . levelByStacks [ btnNum ] , buttonCap ) ;
2014-07-31 19:24:08 +02:00
}
2014-12-29 15:13:47 +01:00
for ( Enum e : this . settings . getSettings ( ) )
2014-07-25 06:59:58 +02:00
{
String Category = " Client " ; // e.getClass().getSimpleName();
2014-12-29 15:13:47 +01:00
Enum value = this . settings . getSetting ( e ) ;
2014-07-25 06:59:58 +02:00
2014-12-29 15:13:47 +01:00
Property p = this . get ( Category , e . name ( ) , value . name ( ) , this . getListComment ( value ) ) ;
2014-07-25 06:59:58 +02:00
try
{
value = Enum . valueOf ( value . getClass ( ) , p . getString ( ) ) ;
}
catch ( IllegalArgumentException er )
{
AELog . info ( " Invalid value ' " + p . getString ( ) + " ' for " + e . name ( ) + " using ' " + value . name ( ) + " ' instead " ) ;
}
2014-12-29 15:13:47 +01:00
this . settings . putSetting ( e , value ) ;
2014-07-25 06:59:58 +02:00
}
}
2014-07-26 02:31:12 +02:00
public boolean disableColoredCableRecipesInNEI ( )
{
2014-12-29 15:13:47 +01:00
return this . disableColoredCableRecipesInNEI ;
2014-07-26 02:31:12 +02:00
}
2014-07-25 06:59:58 +02:00
public String getFilePath ( )
{
2014-12-29 15:13:47 +01:00
return this . myPath . toString ( ) ;
2014-07-25 06:59:58 +02:00
}
2014-02-11 06:50:05 +01:00
public AEConfig ( String path ) {
super ( new File ( path + " AppliedEnergistics2.cfg " ) ) ;
2014-12-29 15:13:47 +01:00
this . myPath = new File ( path + " AppliedEnergistics2.cfg " ) ;
2014-07-25 06:59:58 +02:00
FMLCommonHandler . instance ( ) . bus ( ) . register ( this ) ;
2014-02-09 06:08:27 +01:00
final double DEFAULT_BC_EXCHANGE = 5 . 0 ;
final double DEFAULT_IC2_EXCHANGE = 2 . 0 ;
final double DEFAULT_RTC_EXCHANGE = 1 . 0 / 11256 . 0 ;
final double DEFAULT_RF_EXCHANGE = 0 . 5 ;
2014-07-25 05:20:52 +02:00
final double DEFAULT_MEKANISM_EXCHANGE = 0 . 2 ;
2014-02-09 06:08:27 +01:00
2014-12-29 15:13:47 +01:00
PowerUnits . MJ . conversionRatio = this . get ( " PowerRatios " , " BuildCraft " , DEFAULT_BC_EXCHANGE ) . getDouble ( DEFAULT_BC_EXCHANGE ) ;
PowerUnits . MK . conversionRatio = this . get ( " PowerRatios " , " Mekanism " , DEFAULT_MEKANISM_EXCHANGE ) . getDouble ( DEFAULT_MEKANISM_EXCHANGE ) ;
PowerUnits . EU . conversionRatio = this . get ( " PowerRatios " , " IC2 " , DEFAULT_IC2_EXCHANGE ) . getDouble ( DEFAULT_IC2_EXCHANGE ) ;
PowerUnits . WA . conversionRatio = this . get ( " PowerRatios " , " RotaryCraft " , DEFAULT_RTC_EXCHANGE ) . getDouble ( DEFAULT_RTC_EXCHANGE ) ;
PowerUnits . RF . conversionRatio = this . get ( " PowerRatios " , " ThermalExpansion " , DEFAULT_RF_EXCHANGE ) . getDouble ( DEFAULT_RF_EXCHANGE ) ;
2014-02-09 06:08:27 +01:00
2014-12-29 15:13:47 +01:00
double usageEffective = this . get ( " PowerRatios " , " UsageMultiplier " , 1 . 0 ) . getDouble ( 1 . 0 ) ;
2014-02-09 06:08:27 +01:00
PowerMultiplier . CONFIG . multiplier = Math . max ( 0 . 01 , usageEffective ) ;
2014-12-29 15:13:47 +01:00
CondenserOutput . MATTER_BALLS . requiredPower = this . get ( " Condenser " , " MatterBalls " , 256 ) . getInt ( 256 ) ;
CondenserOutput . SINGULARITY . requiredPower = this . get ( " Condenser " , " Singularity " , 256000 ) . getInt ( 256000 ) ;
2014-02-09 06:08:27 +01:00
2014-12-29 15:13:47 +01:00
this . grinderOres = this . get ( " GrindStone " , " grinderOres " , this . grinderOres ) . getStringList ( ) ;
this . oreDoublePercentage = this . get ( " GrindStone " , " oreDoublePercentage " , this . oreDoublePercentage ) . getDouble ( this . oreDoublePercentage ) ;
2014-03-27 06:14:34 +01:00
2014-12-29 15:13:47 +01:00
this . settings . registerSetting ( Settings . SEARCH_TOOLTIPS , YesNo . YES ) ;
this . settings . registerSetting ( Settings . TERMINAL_STYLE , TerminalStyle . TALL ) ;
this . settings . registerSetting ( Settings . SEARCH_MODE , SearchBoxMode . AUTOSEARCH ) ;
2014-02-09 06:08:27 +01:00
2014-12-29 15:13:47 +01:00
this . spawnChargedChance = ( float ) ( 1 . 0 - this . get ( " worldGen " , " spawnChargedChance " , 1 . 0 - this . spawnChargedChance ) . getDouble ( 1 . 0 - this . spawnChargedChance ) ) ;
this . minMeteoriteDistance = this . get ( " worldGen " , " minMeteoriteDistance " , this . minMeteoriteDistance ) . getInt ( this . minMeteoriteDistance ) ;
this . meteoriteClusterChance = this . get ( " worldGen " , " meteoriteClusterChance " , this . meteoriteClusterChance ) . getDouble ( this . meteoriteClusterChance ) ;
this . meteoriteSpawnChance = this . get ( " worldGen " , " meteoriteSpawnChance " , this . meteoriteSpawnChance ) . getDouble ( this . meteoriteSpawnChance ) ;
this . meteoriteDimensionWhitelist = this . get ( " worldGen " , " meteoriteDimensionWhitelist " , this . meteoriteDimensionWhitelist ) . getIntList ( ) ;
2014-10-19 02:32:51 +02:00
2014-12-29 15:13:47 +01:00
this . quartzOresPerCluster = this . get ( " worldGen " , " quartzOresPerCluster " , this . quartzOresPerCluster ) . getInt ( this . quartzOresPerCluster ) ;
this . quartzOresClusterAmount = this . get ( " worldGen " , " quartzOresClusterAmount " , this . quartzOresClusterAmount ) . getInt ( this . quartzOresClusterAmount ) ;
2014-03-15 07:58:21 +01:00
2014-12-29 15:13:47 +01:00
this . minMeteoriteDistanceSq = this . minMeteoriteDistance * this . minMeteoriteDistance ;
2014-03-15 07:58:21 +01:00
2014-12-29 15:13:47 +01:00
this . addCustomCategoryComment (
2014-05-26 10:26:37 +02:00
" wireless " ,
" Range= WirelessBaseRange + WirelessBoosterRangeMultiplier * Math.pow( boosters, WirelessBoosterExp ) \ nPowerDrain= WirelessBaseCost + WirelessCostMultiplier * Math.pow( boosters, 1 + boosters / WirelessHighWirelessCount ) " ) ;
2014-12-29 15:13:47 +01:00
this . WirelessBaseCost = this . get ( " wireless " , " WirelessBaseCost " , this . WirelessBaseCost ) . getDouble ( this . WirelessBaseCost ) ;
this . WirelessCostMultiplier = this . get ( " wireless " , " WirelessCostMultiplier " , this . WirelessCostMultiplier ) . getDouble ( this . WirelessCostMultiplier ) ;
this . WirelessBaseRange = this . get ( " wireless " , " WirelessBaseRange " , this . WirelessBaseRange ) . getDouble ( this . WirelessBaseRange ) ;
this . WirelessBoosterRangeMultiplier = this . get ( " wireless " , " WirelessBoosterRangeMultiplier " , this . WirelessBoosterRangeMultiplier ) . getDouble (
this . WirelessBoosterRangeMultiplier ) ;
this . WirelessBoosterExp = this . get ( " wireless " , " WirelessBoosterExp " , this . WirelessBoosterExp ) . getDouble ( this . WirelessBoosterExp ) ;
this . WirelessTerminalDrainMultiplier = this . get ( " wireless " , " WirelessTerminalDrainMultiplier " , this . WirelessTerminalDrainMultiplier ) . getDouble (
this . WirelessTerminalDrainMultiplier ) ;
2014-02-09 06:08:27 +01:00
2014-12-29 15:13:47 +01:00
this . formationPlaneEntityLimit = this . get ( " automation " , " formationPlaneEntityLimit " , this . formationPlaneEntityLimit ) . getInt ( this . formationPlaneEntityLimit ) ;
2014-09-07 19:01:09 +02:00
2014-12-29 15:13:47 +01:00
this . wirelessTerminalBattery = this . get ( " battery " , " wirelessTerminal " , this . wirelessTerminalBattery ) . getInt ( this . wirelessTerminalBattery ) ;
this . chargedStaffBattery = this . get ( " battery " , " chargedStaff " , this . chargedStaffBattery ) . getInt ( this . chargedStaffBattery ) ;
this . entropyManipulatorBattery = this . get ( " battery " , " entropyManipulator " , this . entropyManipulatorBattery ) . getInt ( this . entropyManipulatorBattery ) ;
this . portableCellBattery = this . get ( " battery " , " portableCell " , this . portableCellBattery ) . getInt ( this . portableCellBattery ) ;
this . colorApplicatorBattery = this . get ( " battery " , " colorApplicator " , this . colorApplicatorBattery ) . getInt ( this . colorApplicatorBattery ) ;
this . matterCannonBattery = this . get ( " battery " , " matterCannon " , this . matterCannonBattery ) . getInt ( this . matterCannonBattery ) ;
2014-02-09 06:08:27 +01:00
2014-12-29 15:13:47 +01:00
this . clientSync ( ) ;
2014-07-25 06:59:58 +02:00
2014-02-09 06:08:27 +01:00
for ( AEFeature feature : AEFeature . values ( ) )
{
2014-09-28 11:47:17 +02:00
if ( feature . isVisible )
2014-02-09 06:08:27 +01:00
{
2014-12-29 15:13:47 +01:00
if ( this . get ( " Features. " + feature . category , feature . name ( ) , feature . defaultValue ) . getBoolean ( feature . defaultValue ) )
this . featureFlags . add ( feature ) ;
2014-02-09 06:08:27 +01:00
}
else
2014-12-29 15:13:47 +01:00
this . featureFlags . add ( feature ) ;
2014-02-09 06:08:27 +01:00
}
2014-08-30 04:35:07 +02:00
ModContainer imb = cpw . mods . fml . common . Loader . instance ( ) . getIndexedModList ( ) . get ( " ImmibisCore " ) ;
if ( imb ! = null )
{
2014-09-29 09:12:06 +02:00
List < String > version = Arrays . asList ( " 59.0.0 " , " 59.0.1 " , " 59.0.2 " ) ;
2014-08-30 04:35:07 +02:00
if ( version . contains ( imb . getVersion ( ) ) )
2014-12-29 15:13:47 +01:00
this . featureFlags . remove ( AEFeature . AlphaPass ) ;
2014-08-30 04:35:07 +02:00
}
2014-07-29 04:52:02 +02:00
2014-03-06 06:45:14 +01:00
try
{
2014-12-29 15:13:47 +01:00
this . selectedPowerUnit = PowerUnits . valueOf ( this . get ( " Client " , " PowerUnit " , this . selectedPowerUnit . name ( ) , this . getListComment ( this . selectedPowerUnit ) ) . getString ( ) ) ;
2014-03-06 06:45:14 +01:00
}
catch ( Throwable t )
{
2014-12-29 15:13:47 +01:00
this . selectedPowerUnit = PowerUnits . AE ;
2014-03-06 06:45:14 +01:00
}
2014-03-27 06:14:34 +01:00
for ( TickRates tr : TickRates . values ( ) )
2014-03-17 20:59:50 +01:00
{
2014-03-27 06:14:34 +01:00
tr . Load ( this ) ;
2014-03-17 20:59:50 +01:00
}
2014-03-27 06:14:34 +01:00
2014-12-29 15:13:47 +01:00
if ( this . isFeatureEnabled ( AEFeature . SpatialIO ) )
2014-03-05 08:27:42 +01:00
{
2014-12-29 15:13:47 +01:00
this . storageBiomeID = this . get ( " spatialio " , " storageBiomeID " , this . storageBiomeID ) . getInt ( this . storageBiomeID ) ;
this . storageProviderID = this . get ( " spatialio " , " storageProviderID " , this . storageProviderID ) . getInt ( this . storageProviderID ) ;
this . spatialPowerMultiplier = this . get ( " spatialio " , " spatialPowerMultiplier " , this . spatialPowerMultiplier ) . getDouble ( this . spatialPowerMultiplier ) ;
this . spatialPowerExponent = this . get ( " spatialio " , " spatialPowerExponent " , this . spatialPowerExponent ) . getDouble ( this . spatialPowerExponent ) ;
2014-03-05 08:27:42 +01:00
}
2014-12-29 15:13:47 +01:00
if ( this . isFeatureEnabled ( AEFeature . CraftingCPU ) )
2014-08-30 21:50:00 +02:00
{
2014-12-29 15:13:47 +01:00
this . craftingCalculationTimePerTick = this . get ( " craftingCPU " , " craftingCalculationTimePerTick " , this . craftingCalculationTimePerTick ) . getInt (
this . craftingCalculationTimePerTick ) ;
2014-08-30 21:50:00 +02:00
}
2014-12-29 15:13:47 +01:00
if ( this . isFeatureEnabled ( AEFeature . VersionChecker ) )
2014-02-09 06:08:27 +01:00
{
try
{
2014-12-29 15:13:47 +01:00
this . latestVersion = this . get ( " VersionChecker " , " LatestVersion " , " " ) . getString ( ) ;
this . latestTimeStamp = Long . parseLong ( this . get ( " VersionChecker " , " LatestTimeStamp " , " " ) . getString ( ) ) ;
2014-02-09 06:08:27 +01:00
}
catch ( NumberFormatException err )
{
2014-12-29 15:13:47 +01:00
this . latestTimeStamp = 0 ;
2014-02-09 06:08:27 +01:00
}
}
2014-07-25 06:59:58 +02:00
2014-12-29 15:13:47 +01:00
this . updatable = true ;
2014-02-09 06:08:27 +01:00
}
2014-08-03 01:09:41 +02:00
public boolean useAEVersion ( MaterialType mt )
{
2014-12-29 15:13:47 +01:00
if ( this . isFeatureEnabled ( AEFeature . WebsiteRecipes ) )
2014-08-03 01:09:41 +02:00
return true ;
2014-12-29 15:13:47 +01:00
this . setCategoryComment (
2014-08-03 01:09:41 +02:00
" OreCamouflage " ,
" AE2 Automatically uses alternative ores present in your instance of MC to blend better with its surroundings, if you prefer you can disable this selectively using these flags; Its important to note, that some if these items even if enabled may not be craftable in game because other items are overriding their recipes. " ) ;
2014-12-29 15:13:47 +01:00
Property p = this . get ( " OreCamouflage " , mt . name ( ) , true ) ;
2014-08-03 01:09:41 +02:00
p . comment = " OreDictionary Names: " + mt . getOreName ( ) ;
return ! p . getBoolean ( true ) ;
}
2014-05-22 23:29:10 +02:00
private String getListComment ( Enum value )
{
String comment = null ;
2014-05-26 10:26:37 +02:00
2014-05-22 23:29:10 +02:00
if ( value ! = null )
{
2014-05-26 10:26:37 +02:00
EnumSet set = EnumSet . allOf ( value . getClass ( ) ) ;
for ( Object Oeg : set )
2014-05-22 23:29:10 +02:00
{
2014-05-26 10:26:37 +02:00
Enum eg = ( Enum ) Oeg ;
2014-05-22 23:29:10 +02:00
if ( comment = = null )
comment = " Possible Values: " + eg . name ( ) ;
else
2014-05-26 10:26:37 +02:00
comment + = " , " + eg . name ( ) ;
2014-05-22 23:29:10 +02:00
}
}
2014-05-26 10:26:37 +02:00
2014-05-22 23:29:10 +02:00
return comment ;
}
2014-02-09 06:08:27 +01:00
@Override
2014-02-17 01:50:25 +01:00
public void updateSetting ( IConfigManager manager , Enum setting , Enum newValue )
2014-02-09 06:08:27 +01:00
{
2014-12-29 15:13:47 +01:00
for ( Enum e : this . settings . getSettings ( ) )
2014-02-09 06:08:27 +01:00
{
2014-04-20 06:12:25 +02:00
if ( e = = setting )
{
2014-07-30 04:42:17 +02:00
String Category = " Client " ;
2014-12-29 15:13:47 +01:00
Property p = this . get ( Category , e . name ( ) , this . settings . getSetting ( e ) . name ( ) , this . getListComment ( newValue ) ) ;
2014-04-20 06:12:25 +02:00
p . set ( newValue . name ( ) ) ;
}
2014-02-09 06:08:27 +01:00
}
2014-12-29 15:13:47 +01:00
if ( this . updatable )
this . save ( ) ;
2014-02-09 06:08:27 +01:00
}
@Override
public void save ( )
{
2014-12-29 15:13:47 +01:00
if ( this . isFeatureEnabled ( AEFeature . VersionChecker ) )
2014-02-09 06:08:27 +01:00
{
2014-12-29 15:13:47 +01:00
this . get ( " VersionChecker " , " LatestVersion " , this . latestVersion ) . set ( this . latestVersion ) ;
this . get ( " VersionChecker " , " LatestTimeStamp " , " " ) . set ( Long . toString ( this . latestTimeStamp ) ) ;
2014-02-09 06:08:27 +01:00
}
2014-12-29 15:13:47 +01:00
if ( this . isFeatureEnabled ( AEFeature . SpatialIO ) )
2014-03-05 08:27:42 +01:00
{
2014-12-29 15:13:47 +01:00
this . get ( " spatialio " , " storageBiomeID " , this . storageBiomeID ) . set ( this . storageBiomeID ) ;
this . get ( " spatialio " , " storageProviderID " , this . storageProviderID ) . set ( this . storageProviderID ) ;
2014-03-05 08:27:42 +01:00
}
2014-12-29 15:13:47 +01:00
this . get ( " Client " , " PowerUnit " , this . selectedPowerUnit . name ( ) , this . getListComment ( this . selectedPowerUnit ) ) . set ( this . selectedPowerUnit . name ( ) ) ;
2014-03-06 06:45:14 +01:00
2014-12-29 15:13:47 +01:00
if ( this . hasChanged ( ) )
2014-02-09 06:08:27 +01:00
super . save ( ) ;
}
2014-04-06 08:51:44 +02:00
public int getFreeIDSLot ( int varID , String Category )
2014-02-09 06:08:27 +01:00
{
2014-04-06 08:51:44 +02:00
boolean alreadyUsed = false ;
2014-02-09 06:08:27 +01:00
int min = 0 ;
2014-04-06 08:51:44 +02:00
2014-12-29 15:13:47 +01:00
for ( Property p : this . getCategory ( Category ) . getValues ( ) . values ( ) )
2014-04-06 08:51:44 +02:00
{
int thisInt = p . getInt ( ) ;
if ( varID = = thisInt )
alreadyUsed = true ;
min = Math . max ( min , thisInt + 1 ) ;
}
2014-05-02 07:40:46 +02:00
2014-04-06 08:51:44 +02:00
if ( alreadyUsed )
{
2014-04-28 22:00:53 +02:00
if ( min < 16383 )
min = 16383 ;
2014-04-06 08:51:44 +02:00
return min ;
}
return varID ;
2014-02-09 06:08:27 +01:00
}
2014-04-06 08:51:44 +02:00
public int getFreeMaterial ( int varID )
2014-02-09 06:08:27 +01:00
{
2014-12-29 15:13:47 +01:00
return this . getFreeIDSLot ( varID , " materials " ) ;
2014-04-06 08:51:44 +02:00
}
public int getFreePart ( int varID )
{
2014-12-29 15:13:47 +01:00
return this . getFreeIDSLot ( varID , " parts " ) ;
2014-02-09 06:08:27 +01:00
}
@Override
public IConfigManager getConfigManager ( )
{
2014-12-29 15:13:47 +01:00
return this . settings ;
2014-02-09 06:08:27 +01:00
}
public boolean isFeatureEnabled ( AEFeature f )
{
2014-12-29 15:13:47 +01:00
return this . featureFlags . contains ( f ) ;
2014-02-09 06:08:27 +01:00
}
public boolean useTerminalUseLargeFont ( )
{
2014-12-29 15:13:47 +01:00
return this . useLargeFonts ;
2014-02-09 06:08:27 +01:00
}
2014-07-31 19:24:08 +02:00
public int craftItemsByStackAmounts ( int i )
{
2014-12-29 15:13:47 +01:00
return this . craftByStacks [ i ] ;
2014-07-31 19:24:08 +02:00
}
public int priorityByStacksAmounts ( int i )
{
2014-12-29 15:13:47 +01:00
return this . priorityByStacks [ i ] ;
2014-07-31 19:24:08 +02:00
}
2014-08-01 03:59:24 +02:00
public int levelByStackAmounts ( int i )
{
2014-12-29 15:13:47 +01:00
return this . levelByStacks [ i ] ;
2014-08-01 03:59:24 +02:00
}
2014-02-16 10:09:20 +01:00
public Enum getSetting ( String Category , Class < ? extends Enum > class1 , Enum myDefault )
{
String name = class1 . getSimpleName ( ) ;
2014-12-29 15:13:47 +01:00
Property p = this . get ( Category , name , myDefault . name ( ) ) ;
2014-02-16 10:09:20 +01:00
try
{
return ( Enum ) class1 . getField ( p . toString ( ) ) . get ( class1 ) ;
}
catch ( Throwable t )
{
// :{
}
return myDefault ;
}
public void setSetting ( String Category , Enum s )
{
String name = s . getClass ( ) . getSimpleName ( ) ;
2014-12-29 15:13:47 +01:00
this . get ( Category , name , s . name ( ) ) . set ( s . name ( ) ) ;
this . save ( ) ;
2014-02-16 10:09:20 +01:00
}
2014-03-06 06:45:14 +01:00
public PowerUnits selectedPowerUnit ( )
{
2014-12-29 15:13:47 +01:00
return this . selectedPowerUnit ;
2014-03-06 06:45:14 +01:00
}
public void nextPowerUnit ( boolean backwards )
{
2014-12-29 15:13:47 +01:00
this . selectedPowerUnit = Platform . rotateEnum ( this . selectedPowerUnit , backwards , Settings . POWER_UNITS . getPossibleValues ( ) ) ;
this . save ( ) ;
2014-03-06 06:45:14 +01:00
}
2014-07-25 06:59:58 +02:00
2014-02-09 06:08:27 +01:00
}