Basic reformat, hit once, hope never again

This commit is contained in:
thatsIch
2015-04-03 08:54:31 +02:00
parent 4ff1631f89
commit d34c988c88
886 changed files with 31400 additions and 30990 deletions
+174 -200
View File
@@ -48,75 +48,33 @@ import appeng.util.ConfigManager;
import appeng.util.IConfigManagerHost;
import appeng.util.Platform;
public class AEConfig extends Configuration implements IConfigurableObject, IConfigManagerHost
{
public static AEConfig instance;
public static final double TUNNEL_POWER_LOSS = 0.05;
public static final String VERSION = "@version@";
public static final String CHANNEL = "@aechannel@";
public final static String PACKET_CHANNEL = "AE";
public static AEConfig instance;
public final IConfigManager settings = new ConfigManager( this );
public final EnumSet<AEFeature> featureFlags = EnumSet.noneOf( AEFeature.class );
PowerUnits selectedPowerUnit = PowerUnits.AE;
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 };
private final double WirelessHighWirelessCount = 64;
final private File configFile;
public int storageBiomeID = -1;
public int storageProviderID = -1;
public int formationPlaneEntityLimit = 128;
public float spawnChargedChance = 0.92f;
public int quartzOresPerCluster = 4;
public int quartzOresClusterAmount = 15;
public int chargedChange = 4;
public int minMeteoriteDistance = 707;
public int minMeteoriteDistanceSq = this.minMeteoriteDistance * this.minMeteoriteDistance;
private double WirelessBaseCost = 8;
private double WirelessCostMultiplier = 1;
private final double WirelessHighWirelessCount = 64;
private double WirelessTerminalDrainMultiplier = 1;
private double WirelessBaseRange = 16;
private double WirelessBoosterRangeMultiplier = 1;
private double WirelessBoosterExp = 1.5;
public double wireless_getDrainRate(double range)
{
return this.WirelessTerminalDrainMultiplier * range;
}
public double wireless_getMaxRange(int boosters)
{
return this.WirelessBaseRange + this.WirelessBoosterRangeMultiplier * Math.pow( boosters, this.WirelessBoosterExp );
}
public double wireless_getPowerDrain(int boosters)
{
return this.WirelessBaseCost + this.WirelessCostMultiplier * Math.pow( boosters, 1 + boosters / this.WirelessHighWirelessCount );
}
@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;
}
public double spatialPowerExponent = 1.35;
public double spatialPowerMultiplier = 1250.0;
public String[] grinderOres = {
// Vanilla Items
"Obsidian", "Ender", "EnderPearl", "Coal", "Iron", "Gold", "Charcoal", "NetherQuartz",
@@ -126,105 +84,32 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
"CertusQuartz", "Wheat", "Fluix",
// Other Mod Ores
"Brass", "Platinum", "Nickel", "Invar", "Aluminium", "Electrum", "Osmium", "Zinc" };
public double oreDoublePercentage = 90.0;
public boolean enableEffects = true;
public boolean useLargeFonts = false;
public boolean useColoredCraftingStatus;
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 };
public int wirelessTerminalBattery = 1600000;
public int entropyManipulatorBattery = 200000;
public int matterCannonBattery = 200000;
public int portableCellBattery = 20000;
public int colorApplicatorBattery = 20000;
public int chargedStaffBattery = 8000;
public boolean disableColoredCableRecipesInNEI = true;
public boolean updatable = false;
final private File configFile;
public double meteoriteClusterChance = 0.1;
public double meteoriteSpawnChance = 0.3;
public int[] meteoriteDimensionWhitelist = new int[] { 0 };
public int craftingCalculationTimePerTick = 5;
PowerUnits selectedPowerUnit = PowerUnits.AE;
private double WirelessBaseCost = 8;
private double WirelessCostMultiplier = 1;
private double WirelessTerminalDrainMultiplier = 1;
private double WirelessBaseRange = 16;
private double WirelessBoosterRangeMultiplier = 1;
private double WirelessBoosterExp = 1.5;
@SubscribeEvent
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs)
public AEConfig( File configFile )
{
if ( eventArgs.modID.equals( AppEng.MOD_ID ) )
{
this.clientSync();
}
}
private void clientSync()
{
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 );
this.useColoredCraftingStatus = this.get( "Client", "useColoredCraftingStatus", true ).getBoolean( true );
// load buttons..
for (int btnNum = 0; btnNum < 4; btnNum++)
{
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] );
int buttonCap = (int) (Math.pow( 10, btnNum + 1 ) - 1);
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] ) );
cmb.comment = "Controls buttons on Crafting Screen : Capped at " + buttonCap;
pmb.comment = "Controls buttons on Priority Screen : Capped at " + buttonCap;
lmb.comment = "Controls buttons on Level Emitter Screen : Capped at " + buttonCap;
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 );
}
for (Settings e : this.settings.getSettings())
{
String Category = "Client"; // e.getClass().getSimpleName();
Enum<?> value = this.settings.getSetting( e );
Property p = this.get( Category, e.name(), value.name(), this.getListComment( value ) );
try
{
value = Enum.valueOf( value.getClass(), p.getString() );
}
catch (IllegalArgumentException er)
{
AELog.info( "Invalid value '" + p.getString() + "' for " + e.name() + " using '" + value.name() + "' instead" );
}
this.settings.putSetting( e, value );
}
}
public boolean disableColoredCableRecipesInNEI()
{
return this.disableColoredCableRecipesInNEI;
}
public String getFilePath()
{
return this.configFile.toString();
}
public AEConfig( File configFile ) {
super( configFile );
this.configFile = configFile;
@@ -253,29 +138,25 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
this.settings.registerSetting( Settings.TERMINAL_STYLE, TerminalStyle.TALL );
this.settings.registerSetting( Settings.SEARCH_MODE, SearchBoxMode.AUTOSEARCH );
this.spawnChargedChance = (float) (1.0 - this.get( "worldGen", "spawnChargedChance", 1.0 - this.spawnChargedChance ).getDouble( 1.0 - this.spawnChargedChance ));
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();
this.meteoriteDimensionWhitelist = this.get( "worldGen", "meteoriteDimensionWhitelist", this.meteoriteDimensionWhitelist ).getIntList();
this.quartzOresPerCluster = this.get( "worldGen", "quartzOresPerCluster", this.quartzOresPerCluster ).getInt( this.quartzOresPerCluster );
this.quartzOresClusterAmount = this.get( "worldGen", "quartzOresClusterAmount", this.quartzOresClusterAmount ).getInt( this.quartzOresClusterAmount );
this.minMeteoriteDistanceSq = this.minMeteoriteDistance * this.minMeteoriteDistance;
this.addCustomCategoryComment(
"wireless",
"Range= WirelessBaseRange + WirelessBoosterRangeMultiplier * Math.pow( boosters, WirelessBoosterExp )\nPowerDrain= WirelessBaseCost + WirelessCostMultiplier * Math.pow( boosters, 1 + boosters / WirelessHighWirelessCount )" );
this.addCustomCategoryComment( "wireless", "Range= WirelessBaseRange + WirelessBoosterRangeMultiplier * Math.pow( boosters, WirelessBoosterExp )\nPowerDrain= WirelessBaseCost + WirelessCostMultiplier * Math.pow( boosters, 1 + boosters / WirelessHighWirelessCount )" );
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.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 );
this.WirelessTerminalDrainMultiplier = this.get( "wireless", "WirelessTerminalDrainMultiplier", this.WirelessTerminalDrainMultiplier ).getDouble( this.WirelessTerminalDrainMultiplier );
this.formationPlaneEntityLimit = this.get( "automation", "formationPlaneEntityLimit", this.formationPlaneEntityLimit ).getInt( this.formationPlaneEntityLimit );
@@ -288,11 +169,11 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
this.clientSync();
for (AEFeature feature : AEFeature.values())
for( AEFeature feature : AEFeature.values() )
{
if ( feature.isVisible )
if( feature.isVisible )
{
if ( this.get( "Features." + feature.category, feature.name(), feature.defaultValue ).getBoolean( feature.defaultValue ) )
if( this.get( "Features." + feature.category, feature.name(), feature.defaultValue ).getBoolean( feature.defaultValue ) )
this.featureFlags.add( feature );
}
else
@@ -300,10 +181,10 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
}
ModContainer imb = cpw.mods.fml.common.Loader.instance().getIndexedModList().get( "ImmibisCore" );
if ( imb != null )
if( imb != null )
{
List<String> version = Arrays.asList( "59.0.0", "59.0.1", "59.0.2" );
if ( version.contains( imb.getVersion() ) )
if( version.contains( imb.getVersion() ) )
this.featureFlags.remove( AEFeature.AlphaPass );
}
@@ -311,17 +192,17 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
{
this.selectedPowerUnit = PowerUnits.valueOf( this.get( "Client", "PowerUnit", this.selectedPowerUnit.name(), this.getListComment( this.selectedPowerUnit ) ).getString() );
}
catch (Throwable t)
catch( Throwable t )
{
this.selectedPowerUnit = PowerUnits.AE;
}
for (TickRates tr : TickRates.values())
for( TickRates tr : TickRates.values() )
{
tr.Load( this );
}
if ( this.isFeatureEnabled( AEFeature.SpatialIO ) )
if( this.isFeatureEnabled( AEFeature.SpatialIO ) )
{
this.storageBiomeID = this.get( "spatialio", "storageBiomeID", this.storageBiomeID ).getInt( this.storageBiomeID );
this.storageProviderID = this.get( "spatialio", "storageProviderID", this.storageProviderID ).getInt( this.storageProviderID );
@@ -329,41 +210,75 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
this.spatialPowerExponent = this.get( "spatialio", "spatialPowerExponent", this.spatialPowerExponent ).getDouble( this.spatialPowerExponent );
}
if ( this.isFeatureEnabled( AEFeature.CraftingCPU ) )
if( this.isFeatureEnabled( AEFeature.CraftingCPU ) )
{
this.craftingCalculationTimePerTick = this.get( "craftingCPU", "craftingCalculationTimePerTick", this.craftingCalculationTimePerTick ).getInt(
this.craftingCalculationTimePerTick );
this.craftingCalculationTimePerTick = this.get( "craftingCPU", "craftingCalculationTimePerTick", this.craftingCalculationTimePerTick ).getInt( this.craftingCalculationTimePerTick );
}
this.updatable = true;
}
public boolean useAEVersion(MaterialType mt)
private void clientSync()
{
if ( this.isFeatureEnabled( AEFeature.WebsiteRecipes ) )
return true;
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 );
this.useColoredCraftingStatus = this.get( "Client", "useColoredCraftingStatus", true ).getBoolean( true );
this.setCategoryComment(
"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." );
Property p = this.get( "OreCamouflage", mt.name(), true );
p.comment = "OreDictionary Names: " + mt.getOreName();
// load buttons..
for( int btnNum = 0; btnNum < 4; btnNum++ )
{
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] );
return !p.getBoolean( true );
int buttonCap = (int) ( Math.pow( 10, btnNum + 1 ) - 1 );
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] ) );
cmb.comment = "Controls buttons on Crafting Screen : Capped at " + buttonCap;
pmb.comment = "Controls buttons on Priority Screen : Capped at " + buttonCap;
lmb.comment = "Controls buttons on Level Emitter Screen : Capped at " + buttonCap;
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 );
}
for( Settings e : this.settings.getSettings() )
{
String Category = "Client"; // e.getClass().getSimpleName();
Enum<?> value = this.settings.getSetting( e );
Property p = this.get( Category, e.name(), value.name(), this.getListComment( value ) );
try
{
value = Enum.valueOf( value.getClass(), p.getString() );
}
catch( IllegalArgumentException er )
{
AELog.info( "Invalid value '" + p.getString() + "' for " + e.name() + " using '" + value.name() + "' instead" );
}
this.settings.putSetting( e, value );
}
}
private String getListComment(Enum value)
private String getListComment( Enum value )
{
String comment = null;
if ( value != null )
if( value != null )
{
EnumSet set = EnumSet.allOf( value.getClass() );
for (Object Oeg : set)
for( Object Oeg : set )
{
Enum eg = (Enum) Oeg;
if ( comment == null )
if( comment == null )
comment = "Possible Values: " + eg.name();
else
comment += ", " + eg.name();
@@ -373,27 +288,44 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
return comment;
}
@Override
public void updateSetting(IConfigManager manager, Enum setting, Enum newValue)
public boolean isFeatureEnabled( AEFeature f )
{
for (Settings e : this.settings.getSettings())
return this.featureFlags.contains( f );
}
public double wireless_getDrainRate( double range )
{
return this.WirelessTerminalDrainMultiplier * range;
}
public double wireless_getMaxRange( int boosters )
{
return this.WirelessBaseRange + this.WirelessBoosterRangeMultiplier * Math.pow( boosters, this.WirelessBoosterExp );
}
public double wireless_getPowerDrain( int boosters )
{
return this.WirelessBaseCost + this.WirelessCostMultiplier * Math.pow( boosters, 1 + boosters / this.WirelessHighWirelessCount );
}
@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 ( e == setting )
{
String Category = "Client";
Property p = this.get( Category, e.name(), this.settings.getSetting( e ).name(), this.getListComment( newValue ) );
p.set( newValue.name() );
}
if( !category.equals( "Client" ) )
prop.setRequiresMcRestart( true );
}
if ( this.updatable )
this.save();
return prop;
}
@Override
public void save()
{
if ( this.isFeatureEnabled( AEFeature.SpatialIO ) )
if( this.isFeatureEnabled( AEFeature.SpatialIO ) )
{
this.get( "spatialio", "storageBiomeID", this.storageBiomeID ).set( this.storageBiomeID );
this.get( "spatialio", "storageProviderID", this.storageProviderID ).set( this.storageProviderID );
@@ -401,28 +333,81 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
this.get( "Client", "PowerUnit", this.selectedPowerUnit.name(), this.getListComment( this.selectedPowerUnit ) ).set( this.selectedPowerUnit.name() );
if ( this.hasChanged() )
if( this.hasChanged() )
super.save();
}
public int getFreeIDSLot(int varID, String Category)
@SubscribeEvent
public void onConfigChanged( ConfigChangedEvent.OnConfigChangedEvent eventArgs )
{
if( eventArgs.modID.equals( AppEng.MOD_ID ) )
{
this.clientSync();
}
}
public boolean disableColoredCableRecipesInNEI()
{
return this.disableColoredCableRecipesInNEI;
}
public String getFilePath()
{
return this.configFile.toString();
}
public boolean useAEVersion( MaterialType mt )
{
if( this.isFeatureEnabled( AEFeature.WebsiteRecipes ) )
return true;
this.setCategoryComment( "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." );
Property p = this.get( "OreCamouflage", mt.name(), true );
p.comment = "OreDictionary Names: " + mt.getOreName();
return !p.getBoolean( true );
}
@Override
public void updateSetting( IConfigManager manager, Enum setting, Enum newValue )
{
for( Settings e : this.settings.getSettings() )
{
if( e == setting )
{
String Category = "Client";
Property p = this.get( Category, e.name(), this.settings.getSetting( e ).name(), this.getListComment( newValue ) );
p.set( newValue.name() );
}
}
if( this.updatable )
this.save();
}
public int getFreeMaterial( int varID )
{
return this.getFreeIDSLot( varID, "materials" );
}
public int getFreeIDSLot( int varID, String Category )
{
boolean alreadyUsed = false;
int min = 0;
for (Property p : this.getCategory( Category ).getValues().values())
for( Property p : this.getCategory( Category ).getValues().values() )
{
int thisInt = p.getInt();
if ( varID == thisInt )
if( varID == thisInt )
alreadyUsed = true;
min = Math.max( min, thisInt + 1 );
}
if ( alreadyUsed )
if( alreadyUsed )
{
if ( min < 16383 )
if( min < 16383 )
min = 16383;
return min;
@@ -431,12 +416,7 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
return varID;
}
public int getFreeMaterial(int varID)
{
return this.getFreeIDSLot( varID, "materials" );
}
public int getFreePart(int varID)
public int getFreePart( int varID )
{
return this.getFreeIDSLot( varID, "parts" );
}
@@ -447,32 +427,27 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
return this.settings;
}
public boolean isFeatureEnabled(AEFeature f)
{
return this.featureFlags.contains( f );
}
public boolean useTerminalUseLargeFont()
{
return this.useLargeFonts;
}
public int craftItemsByStackAmounts(int i)
public int craftItemsByStackAmounts( int i )
{
return this.craftByStacks[i];
}
public int priorityByStacksAmounts(int i)
public int priorityByStacksAmounts( int i )
{
return this.priorityByStacks[i];
}
public int levelByStackAmounts(int i)
public int levelByStackAmounts( int i )
{
return this.levelByStacks[i];
}
public Enum getSetting(String Category, Class<? extends Enum> class1, Enum myDefault)
public Enum getSetting( String Category, Class<? extends Enum> class1, Enum myDefault )
{
String name = class1.getSimpleName();
Property p = this.get( Category, name, myDefault.name() );
@@ -481,7 +456,7 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
{
return (Enum) class1.getField( p.toString() ).get( class1 );
}
catch (Throwable t)
catch( Throwable t )
{
// :{
}
@@ -489,7 +464,7 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
return myDefault;
}
public void setSetting(String Category, Enum s)
public void setSetting( String Category, Enum s )
{
String name = s.getClass().getSimpleName();
this.get( Category, name, s.name() ).set( s.name() );
@@ -501,10 +476,9 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
return this.selectedPowerUnit;
}
public void nextPowerUnit(boolean backwards)
public void nextPowerUnit( boolean backwards )
{
this.selectedPowerUnit = Platform.rotateEnum( this.selectedPowerUnit, backwards, Settings.POWER_UNITS.getPossibleValues() );
this.save();
}
}