From 5f8570abdcb004cd7b56c1e7cdef299f2b913b7d Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Sat, 8 Feb 2014 23:08:27 -0600 Subject: [PATCH] Rename Configuration to AE Config --- block/misc/BlockCharger.java | 4 +- block/misc/BlockQuartzTorch.java | 4 +- block/misc/BlockVibrationChamber.java | 4 +- block/solids/BlockQuartzLamp.java | 4 +- block/solids/OreQuartzCharged.java | 4 +- client/gui/AEBaseMEGui.java | 6 +- .../gui/implementations/GuiMEMonitorable.java | 12 +- client/me/ItemRepo.java | 4 +- client/render/AppEngRenderItem.java | 10 +- .../ContainerWirelessTerm.java | 4 +- core/{Configuration.java => AEConfig.java} | 469 +++++++++--------- core/AELog.java | 4 +- core/AppEng.java | 10 +- core/FacadeConfig.java | 3 +- core/Registration.java | 6 +- core/WorldSettings.java | 1 + core/crash/CrashEnhancement.java | 4 +- core/features/AEFeatureHandler.java | 4 +- .../registries/GrinderRecipeManager.java | 8 +- core/sync/packets/PacketLightning.java | 4 +- entity/EntityChargedQuartz.java | 4 +- entity/EntityTinyTNTPrimed.java | 4 +- helpers/QuartzWorldGen.java | 6 +- integration/IntegrationNode.java | 6 +- items/materials/ItemMaterial.java | 6 +- items/parts/ItemPart.java | 6 +- items/tools/powered/ToolChargedStaff.java | 4 +- .../tools/powered/ToolEntropyManipulator.java | 4 +- items/tools/powered/ToolMassCannon.java | 6 +- items/tools/powered/ToolPortableCell.java | 4 +- items/tools/powered/ToolWirelessTerminal.java | 4 +- me/cache/SpatialPylonCache.java | 6 +- parts/p2p/PartP2PBCPower.java | 4 +- services/VersionChecker.java | 12 +- tile/networking/TileWireless.java | 6 +- 35 files changed, 327 insertions(+), 324 deletions(-) rename core/{Configuration.java => AEConfig.java} (94%) diff --git a/block/misc/BlockCharger.java b/block/misc/BlockCharger.java index e78ec6b6..8be9a4ab 100644 --- a/block/misc/BlockCharger.java +++ b/block/misc/BlockCharger.java @@ -19,7 +19,7 @@ import appeng.client.render.BaseBlockRender; import appeng.client.render.blocks.RenderBlockCharger; import appeng.client.render.effects.LightningEffect; import appeng.core.CommonHelper; -import appeng.core.Configuration; +import appeng.core.AEConfig; import appeng.core.features.AEFeature; import appeng.helpers.ICustomCollision; import appeng.tile.AEBaseTile; @@ -68,7 +68,7 @@ public class BlockCharger extends AEBaseBlock implements ICustomCollision @SideOnly(Side.CLIENT) public void randomDisplayTick(World w, int x, int y, int z, Random r) { - if ( !Configuration.instance.enableEffects ) + if ( !AEConfig.instance.enableEffects ) return; if ( r.nextFloat() < 0.98 ) diff --git a/block/misc/BlockQuartzTorch.java b/block/misc/BlockQuartzTorch.java index d8c5d87b..f4b0c4a1 100644 --- a/block/misc/BlockQuartzTorch.java +++ b/block/misc/BlockQuartzTorch.java @@ -21,7 +21,7 @@ import appeng.client.render.BaseBlockRender; import appeng.client.render.blocks.RenderQuartzTorch; import appeng.client.render.effects.LightningEffect; import appeng.core.CommonHelper; -import appeng.core.Configuration; +import appeng.core.AEConfig; import appeng.core.features.AEFeature; import appeng.helpers.ICustomCollision; import appeng.helpers.MetaRotation; @@ -110,7 +110,7 @@ public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, I @SideOnly(Side.CLIENT) public void randomDisplayTick(World w, int x, int y, int z, Random r) { - if ( !Configuration.instance.enableEffects ) + if ( !AEConfig.instance.enableEffects ) return; if ( r.nextFloat() < 0.98 ) diff --git a/block/misc/BlockVibrationChamber.java b/block/misc/BlockVibrationChamber.java index 5010860d..cb0f984a 100644 --- a/block/misc/BlockVibrationChamber.java +++ b/block/misc/BlockVibrationChamber.java @@ -11,7 +11,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import appeng.block.AEBaseBlock; import appeng.client.texture.ExtraTextures; -import appeng.core.Configuration; +import appeng.core.AEConfig; import appeng.core.features.AEFeature; import appeng.core.sync.GuiBridge; import appeng.tile.AEBaseTile; @@ -63,7 +63,7 @@ public class BlockVibrationChamber extends AEBaseBlock @Override public void randomDisplayTick(World w, int x, int y, int z, Random r) { - if ( !Configuration.instance.enableEffects ) + if ( !AEConfig.instance.enableEffects ) return; AEBaseTile tile = getTileEntity( w, x, y, z ); diff --git a/block/solids/BlockQuartzLamp.java b/block/solids/BlockQuartzLamp.java index f4df0444..83b39c06 100644 --- a/block/solids/BlockQuartzLamp.java +++ b/block/solids/BlockQuartzLamp.java @@ -8,7 +8,7 @@ import net.minecraft.client.particle.EntityFX; import net.minecraft.world.World; import appeng.client.render.effects.VibrantEffect; import appeng.core.CommonHelper; -import appeng.core.Configuration; +import appeng.core.AEConfig; import appeng.core.features.AEFeature; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -27,7 +27,7 @@ public class BlockQuartzLamp extends BlockQuartzGlass @SideOnly(Side.CLIENT) public void randomDisplayTick(World w, int x, int y, int z, Random r) { - if ( !Configuration.instance.enableEffects ) + if ( !AEConfig.instance.enableEffects ) return; if ( CommonHelper.proxy.shouldAddParticles( r ) ) diff --git a/block/solids/OreQuartzCharged.java b/block/solids/OreQuartzCharged.java index 5d87147a..12527c88 100644 --- a/block/solids/OreQuartzCharged.java +++ b/block/solids/OreQuartzCharged.java @@ -9,7 +9,7 @@ import net.minecraft.world.World; import appeng.api.AEApi; import appeng.client.render.effects.ChargedOreEffect; import appeng.core.CommonHelper; -import appeng.core.Configuration; +import appeng.core.AEConfig; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -32,7 +32,7 @@ public class OreQuartzCharged extends OreQuartz @SideOnly(Side.CLIENT) public void randomDisplayTick(World w, int x, int y, int z, Random r) { - if ( !Configuration.instance.enableEffects ) + if ( !AEConfig.instance.enableEffects ) return; double xOff = (double) (r.nextFloat()); diff --git a/client/gui/AEBaseMEGui.java b/client/gui/AEBaseMEGui.java index d4a2dbfe..4088f4ec 100644 --- a/client/gui/AEBaseMEGui.java +++ b/client/gui/AEBaseMEGui.java @@ -9,7 +9,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import appeng.api.storage.data.IAEItemStack; import appeng.client.me.SlotME; -import appeng.core.Configuration; +import appeng.core.AEConfig; public abstract class AEBaseMEGui extends AEBaseGui { @@ -26,7 +26,7 @@ public abstract class AEBaseMEGui extends AEBaseGui Slot s = getSlot( mousex, mousey ); if ( s instanceof SlotME ) { - int BigNumber = Configuration.instance.useTerminalUseLargeFont() ? 999 : 9999; + int BigNumber = AEConfig.instance.useTerminalUseLargeFont() ? 999 : 9999; IAEItemStack myStack = null; @@ -62,7 +62,7 @@ public abstract class AEBaseMEGui extends AEBaseGui Slot s = getSlot( x, y ); if ( s instanceof SlotME && stack != null ) { - int BigNumber = Configuration.instance.useTerminalUseLargeFont() ? 999 : 9999; + int BigNumber = AEConfig.instance.useTerminalUseLargeFont() ? 999 : 9999; IAEItemStack myStack = null; diff --git a/client/gui/implementations/GuiMEMonitorable.java b/client/gui/implementations/GuiMEMonitorable.java index 7ad084ea..61398819 100644 --- a/client/gui/implementations/GuiMEMonitorable.java +++ b/client/gui/implementations/GuiMEMonitorable.java @@ -18,7 +18,7 @@ import appeng.client.me.InternalSlotME; import appeng.client.me.ItemRepo; import appeng.container.implementations.ContainerMEMonitorable; import appeng.container.slot.AppEngSlot; -import appeng.core.Configuration; +import appeng.core.AEConfig; import appeng.core.localization.GuiText; import appeng.helpers.WirelessTerminalGuiObject; import appeng.parts.reporting.PartTerminal; @@ -117,11 +117,11 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource if ( customSortOrder ) { - buttonList.add( new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_BY, Configuration.instance.settings.getSetting( Settings.SORT_BY ) ) ); + buttonList.add( new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_BY, AEConfig.instance.settings.getSetting( Settings.SORT_BY ) ) ); offset += 20; } - buttonList.add( new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_DIRECTION, Configuration.instance.settings + buttonList.add( new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_DIRECTION, AEConfig.instance.settings .getSetting( Settings.SORT_DIRECTION ) ) ); searchField = new GuiTextField( fontRendererObj, this.guiLeft + Math.max( 82, xoffset ), this.guiTop + 6, 89, fontRendererObj.FONT_HEIGHT ); @@ -152,7 +152,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource Enum cv = iBtn.getCurrentValue(); Enum next = Platform.nextEnum( cv ); - Configuration.instance.settings.putSetting( iBtn.getSetting(), next ); + AEConfig.instance.settings.putSetting( iBtn.getSetting(), next ); iBtn.set( next ); repo.updateView(); } @@ -208,13 +208,13 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource @Override public Enum getSortBy() { - return Configuration.instance.settings.getSetting( Settings.SORT_BY ); + return AEConfig.instance.settings.getSetting( Settings.SORT_BY ); } @Override public Enum getSortDir() { - return Configuration.instance.settings.getSetting( Settings.SORT_DIRECTION ); + return AEConfig.instance.settings.getSetting( Settings.SORT_DIRECTION ); } } diff --git a/client/me/ItemRepo.java b/client/me/ItemRepo.java index 6ef504f3..ea76b446 100644 --- a/client/me/ItemRepo.java +++ b/client/me/ItemRepo.java @@ -12,7 +12,7 @@ import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IItemList; import appeng.client.gui.widgets.IScrollSource; import appeng.client.gui.widgets.ISortSource; -import appeng.core.Configuration; +import appeng.core.AEConfig; import appeng.util.ItemSorters; import appeng.util.Platform; import appeng.util.item.ItemList; @@ -79,7 +79,7 @@ public class ItemRepo view.ensureCapacity( list.size() ); dsp.ensureCapacity( list.size() ); - boolean terminalSearchToolTips = Configuration.instance.settings.getSetting( Settings.SEARCH_TOOLTIPS ) != YesNo.NO; + boolean terminalSearchToolTips = AEConfig.instance.settings.getSetting( Settings.SEARCH_TOOLTIPS ) != YesNo.NO; // boolean terminalSearchMods = Configuration.instance.settings.getSetting( Settings.SEARCH_MODS ) != YesNo.NO; Pattern m = null; diff --git a/client/render/AppEngRenderItem.java b/client/render/AppEngRenderItem.java index 528e3d71..e5fd584f 100644 --- a/client/render/AppEngRenderItem.java +++ b/client/render/AppEngRenderItem.java @@ -9,7 +9,7 @@ import net.minecraft.item.ItemStack; import org.lwjgl.opengl.GL11; import appeng.api.storage.data.IAEItemStack; -import appeng.core.Configuration; +import appeng.core.AEConfig; public class AppEngRenderItem extends RenderItem { @@ -38,9 +38,9 @@ public class AppEngRenderItem extends RenderItem { if ( is != null ) { - float ScaleFactor = Configuration.instance.useTerminalUseLargeFont() ? 0.85f : 0.5f; + float ScaleFactor = AEConfig.instance.useTerminalUseLargeFont() ? 0.85f : 0.5f; float RScaleFactor = 1.0f / ScaleFactor; - int offset = Configuration.instance.useTerminalUseLargeFont() ? 0 : -1; + int offset = AEConfig.instance.useTerminalUseLargeFont() ? 0 : -1; if ( is.isItemDamaged() ) { @@ -63,7 +63,7 @@ public class AppEngRenderItem extends RenderItem if ( is.stackSize == 0 ) { - String var6 = Configuration.instance.useTerminalUseLargeFont() ? "+" : "Craft"; + String var6 = AEConfig.instance.useTerminalUseLargeFont() ? "+" : "Craft"; GL11.glDisable( GL11.GL_LIGHTING ); GL11.glDisable( GL11.GL_DEPTH_TEST ); GL11.glPushMatrix(); @@ -84,7 +84,7 @@ public class AppEngRenderItem extends RenderItem { String var6 = "" + Math.abs( amount ); - if ( Configuration.instance.useTerminalUseLargeFont() ) + if ( AEConfig.instance.useTerminalUseLargeFont() ) { if ( amount > 999999999 ) { diff --git a/container/implementations/ContainerWirelessTerm.java b/container/implementations/ContainerWirelessTerm.java index 574024be..3bf12931 100644 --- a/container/implementations/ContainerWirelessTerm.java +++ b/container/implementations/ContainerWirelessTerm.java @@ -1,7 +1,7 @@ package appeng.container.implementations; import net.minecraft.entity.player.InventoryPlayer; -import appeng.core.Configuration; +import appeng.core.AEConfig; import appeng.core.localization.PlayerMessages; import appeng.helpers.WirelessTerminalGuiObject; @@ -27,7 +27,7 @@ public class ContainerWirelessTerm extends ContainerMEPortableCell } else { - powerMultiplier = Configuration.instance.wireless_getDrainRate( wtgo.getRange() ); + powerMultiplier = AEConfig.instance.wireless_getDrainRate( wtgo.getRange() ); } } } diff --git a/core/Configuration.java b/core/AEConfig.java similarity index 94% rename from core/Configuration.java rename to core/AEConfig.java index 1542e875..75bd0d34 100644 --- a/core/Configuration.java +++ b/core/AEConfig.java @@ -1,234 +1,235 @@ -package appeng.core; - -import java.io.File; -import java.util.EnumSet; - -import net.minecraftforge.common.config.Property; -import appeng.api.config.CondenserOuput; -import appeng.api.config.PowerMultiplier; -import appeng.api.config.PowerUnits; -import appeng.api.config.Settings; -import appeng.api.config.SortDir; -import appeng.api.config.SortOrder; -import appeng.api.config.YesNo; -import appeng.api.util.IConfigManager; -import appeng.api.util.IConfigureableObject; -import appeng.core.features.AEFeature; -import appeng.util.ConfigManager; -import appeng.util.IConfigManagerHost; - -public class Configuration extends net.minecraftforge.common.config.Configuration implements IConfigureableObject, IConfigManagerHost -{ - - public static Configuration instance; - - public static float TunnelPowerLoss = 0.05f; - - 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"; - - public IConfigManager settings = new ConfigManager( this ); - public EnumSet featureFlags = EnumSet.noneOf( AEFeature.class ); - - public int oresPerCluster = 4; - - private double WirelessBaseCost = 8; - private double WirelessCostMultiplier = 1; - private 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 WirelessTerminalDrainMultiplier * range; - } - - public double wireless_getMaxRange(int boosters) - { - return WirelessBaseRange + WirelessBoosterRangeMultiplier * Math.pow( boosters, WirelessBoosterExp ); - } - - public double wireless_getPowerDrain(int boosters) - { - return WirelessBaseCost + WirelessCostMultiplier * Math.pow( boosters, 1 + boosters / WirelessHighWirelessCount ); - } - - public double spatialPowerScaler = 1.5; - public double spatialPowerMultiplier = 1500.0; - - public String grinderOres[] = { - // Vanilla Items - "Obsidian", "Ender", "Coal", "Iron", "Gold", "Charcoal", "NetherQuartz", - // Common Mod Ores - "Copper", "Tin", "Silver", "Lead", "Bronze", - // AE - "CertusQuartz", "Wheat", "Fluix", - // Other Mod Ores - "Brass", "Platinum", "Nickel", "Invar", "Aluminium", "Electrum" }; - - public double oreDoublePercentage = 90.0; - - public boolean enableEffects = true; - - public int wireless_battery = 1600000; - public int manipulator_battery = 200000; - public int mattercannon_battery = 200000; - public int portablecell_battery = 20000; - public int staff_battery = 8000; - - public Configuration(File f) { - super( new File( f.getPath() + File.separator + "AppliedEnergistics2" + File.separator + "AppliedEnergistics2.cfg" ) ); - - final double DEFAULT_BC_EXCHANGE = 5.0; - // final double DEFAULT_UE_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; - - PowerUnits.MJ.conversionRatio = get( "PowerRatios", "BuildCraft", DEFAULT_BC_EXCHANGE ).getDouble( DEFAULT_BC_EXCHANGE ); - // PowerUnits.KJ.conversionRatio = get( "PowerRatios", - // "UniversalElectricity", DEFAULT_UE_EXCHANGE ).getDouble( - // DEFAULT_UE_EXCHANGE ); - PowerUnits.EU.conversionRatio = get( "PowerRatios", "IC2", DEFAULT_IC2_EXCHANGE ).getDouble( DEFAULT_IC2_EXCHANGE ); - PowerUnits.WA.conversionRatio = get( "PowerRatios", "RotaryCraft", DEFAULT_RTC_EXCHANGE ).getDouble( DEFAULT_RTC_EXCHANGE ); - PowerUnits.RF.conversionRatio = get( "PowerRatios", "ThermalExpansion", DEFAULT_RF_EXCHANGE ).getDouble( DEFAULT_RF_EXCHANGE ); - - double usageEffective = get( "PowerRatios", "UsageMultiplier", 1.0 ).getDouble( 1.0 ); - PowerMultiplier.CONFIG.multiplier = Math.max( 0.01, usageEffective ); - - CondenserOuput.MATTER_BALLS.requiredPower = get( "Condenser", "MatterBalls", 256 ).getInt( 256 ); - CondenserOuput.SINGULARITY.requiredPower = get( "Condenser", "Singularity", 256000 ).getInt( 256000 ); - - grinderOres = get( "GrindStone", "grinderOres", grinderOres ).getStringList(); - oreDoublePercentage = get( "GrindStone", "oreDoublePercentage", oreDoublePercentage ).getDouble( oreDoublePercentage ); - enableEffects = get( "Client", "enableEffects", true ).getBoolean( true ); - - // settings.registerSetting( Settings.SEARCH_MODS, YesNo.YES ); - settings.registerSetting( Settings.SEARCH_TOOLTIPS, YesNo.YES ); - settings.registerSetting( Settings.SORT_BY, SortOrder.NAME ); - settings.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING ); - - WirelessBaseCost = get( "wireless", "WirelessBaseCost", WirelessBaseCost ).getDouble( WirelessBaseCost ); - WirelessCostMultiplier = get( "wireless", "WirelessCostMultiplier", WirelessCostMultiplier ).getDouble( WirelessCostMultiplier ); - WirelessBaseRange = get( "wireless", "WirelessBaseRange", WirelessBaseRange ).getDouble( WirelessBaseRange ); - WirelessBoosterRangeMultiplier = get( "wireless", "WirelessBoosterRangeMultiplier", WirelessBoosterRangeMultiplier ).getDouble( - WirelessBoosterRangeMultiplier ); - WirelessBoosterExp = get( "wireless", "WirelessBoosterExp", WirelessBoosterExp ).getDouble( WirelessBoosterExp ); - WirelessTerminalDrainMultiplier = get( "wireless", "WirelessTerminalDrainMultiplier", WirelessTerminalDrainMultiplier ).getDouble( - WirelessTerminalDrainMultiplier ); - - wireless_battery = get( "battery", "wireless", wireless_battery ).getInt( wireless_battery ); - staff_battery = get( "battery", "staff", staff_battery ).getInt( staff_battery ); - manipulator_battery = get( "battery", "manipulator", manipulator_battery ).getInt( manipulator_battery ); - portablecell_battery = get( "battery", "portablecell", portablecell_battery ).getInt( portablecell_battery ); - mattercannon_battery = get( "battery", "mattercannon", mattercannon_battery ).getInt( mattercannon_battery ); - - for (AEFeature feature : AEFeature.values()) - { - if ( feature.isVisible() ) - { - if ( get( "Features." + feature.getCategory(), feature.name(), feature.defaultVaue() ).getBoolean( feature.defaultVaue() ) ) - featureFlags.add( feature ); - } - else - featureFlags.add( feature ); - } - - for (Enum e : settings.getSettings()) - { - String Category = e.getClass().getSimpleName(); - this.get( Category, e.name(), settings.getSetting( e ).name() ); - } - - if ( isFeatureEnabled( AEFeature.VersionChecker ) ) - { - try - { - latestVersion = get( "VersionChecker", "LatestVersion", "" ).getString(); - latestTimeStamp = Long.parseLong( get( "VersionChecker", "LatestTimeStamp", "" ).getString() ); - } - catch (NumberFormatException err) - { - latestTimeStamp = 0; - } - } - } - - @Override - public void updateSetting(Enum setting, Enum newValue) - { - for (Enum e : settings.getSettings()) - { - String Category = e.getClass().getSimpleName(); - this.get( Category, e.name(), settings.getSetting( e ).name() ); - } - - save(); - } - - @Override - public void save() - { - if ( isFeatureEnabled( AEFeature.VersionChecker ) ) - { - get( "VersionChecker", "LatestVersion", latestVersion ).set( latestVersion ); - get( "VersionChecker", "LatestTimeStamp", "" ).set( Long.toString( latestTimeStamp ) ); - } - - if ( hasChanged() ) - super.save(); - } - - public int getFreeMaterial() - { - int min = 0; - for (Property p : getCategory( "materials" ).getValues().values()) - min = Math.max( min, p.getInt() + 1 ); - return min; - } - - public int getFreePart() - { - int min = 0; - for (Property p : getCategory( "parts" ).getValues().values()) - min = Math.max( min, p.getInt() + 1 ); - return min; - } - - @Override - public IConfigManager getConfigManager() - { - return settings; - } - - public boolean isFeatureEnabled(AEFeature f) - { - return featureFlags.contains( f ); - } - - public int getBlockID(Class c, String subname) - { - return 0; - // return getBlock( AEFeatureHandler.getName( c, subname ), blkBaseNumber++ ).getInt(); - } - - public int getItemID(Class c, String subname) - { - return 0; - // return getItem( AEFeatureHandler.getName( c, subname ), blkItemNumber++ ).getInt(); - } - - public boolean useTerminalUseLargeFont() - { - return false; - } - -} +package appeng.core; + +import java.io.File; +import java.util.EnumSet; + +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.common.config.Property; +import appeng.api.config.CondenserOuput; +import appeng.api.config.PowerMultiplier; +import appeng.api.config.PowerUnits; +import appeng.api.config.Settings; +import appeng.api.config.SortDir; +import appeng.api.config.SortOrder; +import appeng.api.config.YesNo; +import appeng.api.util.IConfigManager; +import appeng.api.util.IConfigureableObject; +import appeng.core.features.AEFeature; +import appeng.util.ConfigManager; +import appeng.util.IConfigManagerHost; + +public class AEConfig extends Configuration implements IConfigureableObject, IConfigManagerHost +{ + + public static AEConfig instance; + + public static float TunnelPowerLoss = 0.05f; + + 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"; + + public IConfigManager settings = new ConfigManager( this ); + public EnumSet featureFlags = EnumSet.noneOf( AEFeature.class ); + + public int oresPerCluster = 4; + + private double WirelessBaseCost = 8; + private double WirelessCostMultiplier = 1; + private 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 WirelessTerminalDrainMultiplier * range; + } + + public double wireless_getMaxRange(int boosters) + { + return WirelessBaseRange + WirelessBoosterRangeMultiplier * Math.pow( boosters, WirelessBoosterExp ); + } + + public double wireless_getPowerDrain(int boosters) + { + return WirelessBaseCost + WirelessCostMultiplier * Math.pow( boosters, 1 + boosters / WirelessHighWirelessCount ); + } + + public double spatialPowerScaler = 1.5; + public double spatialPowerMultiplier = 1500.0; + + public String grinderOres[] = { + // Vanilla Items + "Obsidian", "Ender", "Coal", "Iron", "Gold", "Charcoal", "NetherQuartz", + // Common Mod Ores + "Copper", "Tin", "Silver", "Lead", "Bronze", + // AE + "CertusQuartz", "Wheat", "Fluix", + // Other Mod Ores + "Brass", "Platinum", "Nickel", "Invar", "Aluminium", "Electrum" }; + + public double oreDoublePercentage = 90.0; + + public boolean enableEffects = true; + + public int wireless_battery = 1600000; + public int manipulator_battery = 200000; + public int mattercannon_battery = 200000; + public int portablecell_battery = 20000; + public int staff_battery = 8000; + + public AEConfig(File f) { + super( new File( f.getPath() + File.separator + "AppliedEnergistics2" + File.separator + "AppliedEnergistics2.cfg" ) ); + + final double DEFAULT_BC_EXCHANGE = 5.0; + // final double DEFAULT_UE_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; + + PowerUnits.MJ.conversionRatio = get( "PowerRatios", "BuildCraft", DEFAULT_BC_EXCHANGE ).getDouble( DEFAULT_BC_EXCHANGE ); + // PowerUnits.KJ.conversionRatio = get( "PowerRatios", + // "UniversalElectricity", DEFAULT_UE_EXCHANGE ).getDouble( + // DEFAULT_UE_EXCHANGE ); + PowerUnits.EU.conversionRatio = get( "PowerRatios", "IC2", DEFAULT_IC2_EXCHANGE ).getDouble( DEFAULT_IC2_EXCHANGE ); + PowerUnits.WA.conversionRatio = get( "PowerRatios", "RotaryCraft", DEFAULT_RTC_EXCHANGE ).getDouble( DEFAULT_RTC_EXCHANGE ); + PowerUnits.RF.conversionRatio = get( "PowerRatios", "ThermalExpansion", DEFAULT_RF_EXCHANGE ).getDouble( DEFAULT_RF_EXCHANGE ); + + double usageEffective = get( "PowerRatios", "UsageMultiplier", 1.0 ).getDouble( 1.0 ); + PowerMultiplier.CONFIG.multiplier = Math.max( 0.01, usageEffective ); + + CondenserOuput.MATTER_BALLS.requiredPower = get( "Condenser", "MatterBalls", 256 ).getInt( 256 ); + CondenserOuput.SINGULARITY.requiredPower = get( "Condenser", "Singularity", 256000 ).getInt( 256000 ); + + grinderOres = get( "GrindStone", "grinderOres", grinderOres ).getStringList(); + oreDoublePercentage = get( "GrindStone", "oreDoublePercentage", oreDoublePercentage ).getDouble( oreDoublePercentage ); + enableEffects = get( "Client", "enableEffects", true ).getBoolean( true ); + + // settings.registerSetting( Settings.SEARCH_MODS, YesNo.YES ); + settings.registerSetting( Settings.SEARCH_TOOLTIPS, YesNo.YES ); + settings.registerSetting( Settings.SORT_BY, SortOrder.NAME ); + settings.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING ); + + WirelessBaseCost = get( "wireless", "WirelessBaseCost", WirelessBaseCost ).getDouble( WirelessBaseCost ); + WirelessCostMultiplier = get( "wireless", "WirelessCostMultiplier", WirelessCostMultiplier ).getDouble( WirelessCostMultiplier ); + WirelessBaseRange = get( "wireless", "WirelessBaseRange", WirelessBaseRange ).getDouble( WirelessBaseRange ); + WirelessBoosterRangeMultiplier = get( "wireless", "WirelessBoosterRangeMultiplier", WirelessBoosterRangeMultiplier ).getDouble( + WirelessBoosterRangeMultiplier ); + WirelessBoosterExp = get( "wireless", "WirelessBoosterExp", WirelessBoosterExp ).getDouble( WirelessBoosterExp ); + WirelessTerminalDrainMultiplier = get( "wireless", "WirelessTerminalDrainMultiplier", WirelessTerminalDrainMultiplier ).getDouble( + WirelessTerminalDrainMultiplier ); + + wireless_battery = get( "battery", "wireless", wireless_battery ).getInt( wireless_battery ); + staff_battery = get( "battery", "staff", staff_battery ).getInt( staff_battery ); + manipulator_battery = get( "battery", "manipulator", manipulator_battery ).getInt( manipulator_battery ); + portablecell_battery = get( "battery", "portablecell", portablecell_battery ).getInt( portablecell_battery ); + mattercannon_battery = get( "battery", "mattercannon", mattercannon_battery ).getInt( mattercannon_battery ); + + for (AEFeature feature : AEFeature.values()) + { + if ( feature.isVisible() ) + { + if ( get( "Features." + feature.getCategory(), feature.name(), feature.defaultVaue() ).getBoolean( feature.defaultVaue() ) ) + featureFlags.add( feature ); + } + else + featureFlags.add( feature ); + } + + for (Enum e : settings.getSettings()) + { + String Category = e.getClass().getSimpleName(); + this.get( Category, e.name(), settings.getSetting( e ).name() ); + } + + if ( isFeatureEnabled( AEFeature.VersionChecker ) ) + { + try + { + latestVersion = get( "VersionChecker", "LatestVersion", "" ).getString(); + latestTimeStamp = Long.parseLong( get( "VersionChecker", "LatestTimeStamp", "" ).getString() ); + } + catch (NumberFormatException err) + { + latestTimeStamp = 0; + } + } + } + + @Override + public void updateSetting(Enum setting, Enum newValue) + { + for (Enum e : settings.getSettings()) + { + String Category = e.getClass().getSimpleName(); + this.get( Category, e.name(), settings.getSetting( e ).name() ); + } + + save(); + } + + @Override + public void save() + { + if ( isFeatureEnabled( AEFeature.VersionChecker ) ) + { + get( "VersionChecker", "LatestVersion", latestVersion ).set( latestVersion ); + get( "VersionChecker", "LatestTimeStamp", "" ).set( Long.toString( latestTimeStamp ) ); + } + + if ( hasChanged() ) + super.save(); + } + + public int getFreeMaterial() + { + int min = 0; + for (Property p : getCategory( "materials" ).getValues().values()) + min = Math.max( min, p.getInt() + 1 ); + return min; + } + + public int getFreePart() + { + int min = 0; + for (Property p : getCategory( "parts" ).getValues().values()) + min = Math.max( min, p.getInt() + 1 ); + return min; + } + + @Override + public IConfigManager getConfigManager() + { + return settings; + } + + public boolean isFeatureEnabled(AEFeature f) + { + return featureFlags.contains( f ); + } + + public int getBlockID(Class c, String subname) + { + return 0; + // return getBlock( AEFeatureHandler.getName( c, subname ), blkBaseNumber++ ).getInt(); + } + + public int getItemID(Class c, String subname) + { + return 0; + // return getItem( AEFeatureHandler.getName( c, subname ), blkItemNumber++ ).getInt(); + } + + public boolean useTerminalUseLargeFont() + { + return false; + } + +} diff --git a/core/AELog.java b/core/AELog.java index f163fe3b..1f45a981 100644 --- a/core/AELog.java +++ b/core/AELog.java @@ -16,7 +16,7 @@ public class AELog private static void log(Level level, String format, Object... data) { - if ( Configuration.instance == null || Configuration.instance.isFeatureEnabled( AEFeature.Logging ) ) + if ( AEConfig.instance == null || AEConfig.instance.isFeatureEnabled( AEFeature.Logging ) ) { FMLRelaunchLog.log( "AE2:" + (Platform.isServer() ? "S" : "C"), level, format, data ); } @@ -44,7 +44,7 @@ public class AELog public static void error(Throwable e) { - if ( Configuration.instance.isFeatureEnabled( AEFeature.Logging ) ) + if ( AEConfig.instance.isFeatureEnabled( AEFeature.Logging ) ) { severe( "Error: " + e.getMessage() ); e.printStackTrace(); diff --git a/core/AppEng.java b/core/AppEng.java index e3bc8a6b..9626a500 100644 --- a/core/AppEng.java +++ b/core/AppEng.java @@ -22,7 +22,7 @@ import cpw.mods.fml.common.event.FMLServerStartingEvent; import cpw.mods.fml.common.event.FMLServerStoppingEvent; import cpw.mods.fml.common.network.NetworkRegistry; -@Mod(modid = AppEng.modid, name = AppEng.name, version = Configuration.VERSION, dependencies = AppEng.dependencies) +@Mod(modid = AppEng.modid, name = AppEng.name, version = AEConfig.VERSION, dependencies = AppEng.dependencies) public class AppEng { @@ -97,7 +97,7 @@ public class AppEng @EventHandler void PreInit(FMLPreInitializationEvent event) { - Configuration.instance = new Configuration( event.getModConfigurationDirectory() ); + AEConfig.instance = new AEConfig( event.getModConfigurationDirectory() ); FacadeConfig.instance = new FacadeConfig( event.getModConfigurationDirectory() ); AELog.info( "Starting ( PreInit )" ); @@ -111,13 +111,13 @@ public class AppEng Registration.instance.PreInit( event ); - if ( Configuration.instance.isFeatureEnabled( AEFeature.Profiler ) ) + if ( AEConfig.instance.isFeatureEnabled( AEFeature.Profiler ) ) { AELog.info( "Starting Profiler" ); startService( "AE2 Profiler", (new Thread( Profiler.instance = new Profiler() )) ); } - if ( Configuration.instance.isFeatureEnabled( AEFeature.VersionChecker ) ) + if ( AEConfig.instance.isFeatureEnabled( AEFeature.VersionChecker ) ) { AELog.info( "Starting VersionChecker" ); startService( "AE2 VersionChecker", new Thread( VersionChecker.instance = new VersionChecker() ) ); @@ -145,7 +145,7 @@ public class AppEng Registration.instance.PostInit( event ); integrationModules.postinit(); - Configuration.instance.save(); + AEConfig.instance.save(); NetworkRegistry.INSTANCE.registerGuiHandler( this, GuiBridge.GUI_Handler ); NetworkHandler.instance = new NetworkHandler( "AE2" ); diff --git a/core/FacadeConfig.java b/core/FacadeConfig.java index 4862f893..e3dc3278 100644 --- a/core/FacadeConfig.java +++ b/core/FacadeConfig.java @@ -6,10 +6,11 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import net.minecraft.block.Block; +import net.minecraftforge.common.config.Configuration; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier; -public class FacadeConfig extends net.minecraftforge.common.config.Configuration +public class FacadeConfig extends Configuration { public static FacadeConfig instance; diff --git a/core/Registration.java b/core/Registration.java index 99a6881f..aac2e91e 100644 --- a/core/Registration.java +++ b/core/Registration.java @@ -484,7 +484,7 @@ public class Registration AEApi.instance().registries().wireless().registerWirelessHandler( (IWirelessTermHandler) AEApi.instance().items().itemWirelessTerminal.item() ); - if ( Configuration.instance.isFeatureEnabled( AEFeature.ChestLoot ) ) + if ( AEConfig.instance.isFeatureEnabled( AEFeature.ChestLoot ) ) { ChestGenHooks d = ChestGenHooks.getInfo( ChestGenHooks.MINESHAFT_CORRIDOR ); d.addItem( new WeightedRandomChestContent( AEApi.instance().materials().materialCertusQuartzCrystal.stack( 1 ), 1, 4, 2 ) ); @@ -492,10 +492,10 @@ public class Registration } // add villager trading to black smiths for a few basic materials - if ( Configuration.instance.isFeatureEnabled( AEFeature.VillagerTrading ) ) + if ( AEConfig.instance.isFeatureEnabled( AEFeature.VillagerTrading ) ) VillagerRegistry.instance().registerVillageTradeHandler( 3, new AETrading() ); - if ( Configuration.instance.isFeatureEnabled( AEFeature.CertusQuartzWorldGen ) ) + if ( AEConfig.instance.isFeatureEnabled( AEFeature.CertusQuartzWorldGen ) ) GameRegistry.registerWorldGenerator( new QuartzWorldGen(), 0 ); } diff --git a/core/WorldSettings.java b/core/WorldSettings.java index d85e7cb0..a7f6d56b 100644 --- a/core/WorldSettings.java +++ b/core/WorldSettings.java @@ -8,6 +8,7 @@ import java.util.WeakHashMap; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.config.ConfigCategory; +import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; import appeng.api.util.WorldCoord; import appeng.me.GridStorage; diff --git a/core/crash/CrashEnhancement.java b/core/crash/CrashEnhancement.java index e8ae27ca..13e41649 100644 --- a/core/crash/CrashEnhancement.java +++ b/core/crash/CrashEnhancement.java @@ -1,6 +1,6 @@ package appeng.core.crash; -import appeng.core.Configuration; +import appeng.core.AEConfig; import appeng.integration.IntegrationRegistry; import cpw.mods.fml.common.ICrashCallable; @@ -19,7 +19,7 @@ public class CrashEnhancement implements ICrashCallable switch (Output) { case MOD_VERSION: - return Configuration.CHANNEL + " " + Configuration.VERSION + " for Forge " + return AEConfig.CHANNEL + " " + AEConfig.VERSION + " for Forge " + net.minecraftforge.common.ForgeVersion.majorVersion + "." // majorVersion + net.minecraftforge.common.ForgeVersion.minorVersion + "." // minorVersion + net.minecraftforge.common.ForgeVersion.revisionVersion + "." // revisionVersion diff --git a/core/features/AEFeatureHandler.java b/core/features/AEFeatureHandler.java index b912b7e1..10465ce0 100644 --- a/core/features/AEFeatureHandler.java +++ b/core/features/AEFeatureHandler.java @@ -10,7 +10,7 @@ import appeng.api.util.AEItemDefinition; import appeng.block.AEBaseBlock; import appeng.block.AEBaseItemBlock; import appeng.core.CommonHelper; -import appeng.core.Configuration; +import appeng.core.AEConfig; import appeng.core.CreativeTab; import appeng.core.CreativeTabFacade; import appeng.items.parts.ItemFacade; @@ -115,7 +115,7 @@ public class AEFeatureHandler implements AEItemDefinition boolean enabled = true; for (AEFeature f : myFeatures) - enabled = enabled && Configuration.instance.isFeatureEnabled( f ); + enabled = enabled && AEConfig.instance.isFeatureEnabled( f ); return enabled; } diff --git a/core/features/registries/GrinderRecipeManager.java b/core/features/registries/GrinderRecipeManager.java index b58dfb49..b73ae292 100644 --- a/core/features/registries/GrinderRecipeManager.java +++ b/core/features/registries/GrinderRecipeManager.java @@ -12,7 +12,7 @@ import net.minecraft.item.ItemStack; import appeng.api.features.IGrinderEntry; import appeng.api.features.IGrinderRegistry; import appeng.core.AELog; -import appeng.core.Configuration; +import appeng.core.AEConfig; import appeng.core.features.registries.entries.AppEngGrinderRecipe; import appeng.recipes.ores.IOreListener; import appeng.recipes.ores.OreDictionaryHandler; @@ -144,7 +144,7 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener { ItemStack extra = is.copy(); extra.stackSize = ratio - 1; - addRecipe( item, is, extra, (float) (Configuration.instance.oreDoublePercentage / 100.0), 8 ); + addRecipe( item, is, extra, (float) (AEConfig.instance.oreDoublePercentage / 100.0), 8 ); } else addRecipe( item, is, 8 ); @@ -189,7 +189,7 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener { ItemStack extra = is.copy(); extra.stackSize = ratio - 1; - addRecipe( d.getKey(), is, extra, (float) (Configuration.instance.oreDoublePercentage / 100.0), 8 ); + addRecipe( d.getKey(), is, extra, (float) (AEConfig.instance.oreDoublePercentage / 100.0), 8 ); } else addRecipe( d.getKey(), is, 8 ); @@ -205,7 +205,7 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener { if ( Name.startsWith( "ore" ) || Name.startsWith( "crystal" ) || Name.startsWith( "ingot" ) || Name.startsWith( "dust" ) ) { - for (String ore : Configuration.instance.grinderOres) + for (String ore : AEConfig.instance.grinderOres) { if ( Name.equals( "ore" + ore ) ) { diff --git a/core/sync/packets/PacketLightning.java b/core/sync/packets/PacketLightning.java index 8337ac72..29cf964c 100644 --- a/core/sync/packets/PacketLightning.java +++ b/core/sync/packets/PacketLightning.java @@ -10,7 +10,7 @@ import net.minecraft.client.particle.EntityFX; import net.minecraft.entity.player.EntityPlayer; import appeng.client.ClientHelper; import appeng.client.render.effects.LightningEffect; -import appeng.core.Configuration; +import appeng.core.AEConfig; import appeng.core.sync.AppEngPacket; import appeng.core.sync.network.INetworkInfo; import appeng.util.Platform; @@ -37,7 +37,7 @@ public class PacketLightning extends AppEngPacket { try { - if ( Platform.isClient() && Configuration.instance.enableEffects ) + if ( Platform.isClient() && AEConfig.instance.enableEffects ) { LightningEffect fx = new LightningEffect( ClientHelper.proxy.getWorld(), x, y, z, 0.0f, 0.0f, 0.0f ); Minecraft.getMinecraft().effectRenderer.addEffect( (EntityFX) fx ); diff --git a/entity/EntityChargedQuartz.java b/entity/EntityChargedQuartz.java index f017f21b..7138ee61 100644 --- a/entity/EntityChargedQuartz.java +++ b/entity/EntityChargedQuartz.java @@ -13,7 +13,7 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import appeng.api.AEApi; import appeng.core.CommonHelper; -import appeng.core.Configuration; +import appeng.core.AEConfig; import appeng.util.Platform; final public class EntityChargedQuartz extends EntityItem @@ -35,7 +35,7 @@ final public class EntityChargedQuartz extends EntityItem { super.onUpdate(); - if ( Platform.isClient() && delay++ > 30 && Configuration.instance.enableEffects ) + if ( Platform.isClient() && delay++ > 30 && AEConfig.instance.enableEffects ) { CommonHelper.proxy.spawnLightning( worldObj, posX, posY, posZ ); delay = 0; diff --git a/entity/EntityTinyTNTPrimed.java b/entity/EntityTinyTNTPrimed.java index f3bc24f2..37796e94 100644 --- a/entity/EntityTinyTNTPrimed.java +++ b/entity/EntityTinyTNTPrimed.java @@ -14,7 +14,7 @@ import net.minecraft.util.DamageSource; import net.minecraft.world.World; import appeng.api.AEApi; import appeng.core.CommonHelper; -import appeng.core.Configuration; +import appeng.core.AEConfig; import appeng.core.features.AEFeature; import appeng.core.sync.packets.PacketMockExplosion; import appeng.util.Platform; @@ -97,7 +97,7 @@ final public class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit return; } - if ( Configuration.instance.isFeatureEnabled( AEFeature.TinyTNTBlockDamage ) ) + if ( AEConfig.instance.isFeatureEnabled( AEFeature.TinyTNTBlockDamage ) ) { posY -= 0.25; diff --git a/helpers/QuartzWorldGen.java b/helpers/QuartzWorldGen.java index bf1a2a51..a9cc5515 100644 --- a/helpers/QuartzWorldGen.java +++ b/helpers/QuartzWorldGen.java @@ -9,7 +9,7 @@ import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; import appeng.api.AEApi; -import appeng.core.Configuration; +import appeng.core.AEConfig; import cpw.mods.fml.common.IWorldGenerator; final public class QuartzWorldGen implements IWorldGenerator @@ -27,8 +27,8 @@ final public class QuartzWorldGen implements IWorldGenerator if ( normal == null || charged == null ) { - oreNormal = new WorldGenMinable( normal, is_normal.getItemDamage(), Configuration.instance.oresPerCluster, Blocks.stone ); - oreCharged = new WorldGenMinable( charged, is_charged.getItemDamage(), Configuration.instance.oresPerCluster, Blocks.stone ); + oreNormal = new WorldGenMinable( normal, is_normal.getItemDamage(), AEConfig.instance.oresPerCluster, Blocks.stone ); + oreCharged = new WorldGenMinable( charged, is_charged.getItemDamage(), AEConfig.instance.oresPerCluster, Blocks.stone ); } else oreNormal = oreCharged = null; diff --git a/integration/IntegrationNode.java b/integration/IntegrationNode.java index 12a53186..eae69182 100644 --- a/integration/IntegrationNode.java +++ b/integration/IntegrationNode.java @@ -4,7 +4,7 @@ import java.lang.reflect.Field; import appeng.api.exceptions.ModNotInstalled; import appeng.core.AELog; -import appeng.core.Configuration; +import appeng.core.AEConfig; import cpw.mods.fml.common.Loader; public class IntegrationNode @@ -42,11 +42,11 @@ public class IntegrationNode boolean enabled = modID == null || Loader.isModLoaded( modID ); - Configuration.instance + AEConfig.instance .addCustomCategoryComment( "ModIntegration", "Valid Values are 'AUTO', 'ON', or 'OFF' - defaults to 'AUTO' ; Suggested that you leave this alone unless your experiencing an issue, or wish to disable the integration for a reason." ); - String Mode = Configuration.instance.get( "ModIntegration", displayName.replace( " ", "" ), "AUTO" ).getString(); + String Mode = AEConfig.instance.get( "ModIntegration", displayName.replace( " ", "" ), "AUTO" ).getString(); if ( Mode.toUpperCase().equals( "ON" ) ) enabled = true; diff --git a/items/materials/ItemMaterial.java b/items/materials/ItemMaterial.java index 706c94d8..61020a48 100644 --- a/items/materials/ItemMaterial.java +++ b/items/materials/ItemMaterial.java @@ -24,7 +24,7 @@ import appeng.api.config.Upgrades; import appeng.api.implementations.items.IItemGroup; import appeng.api.implementations.items.IStorageComponent; import appeng.api.implementations.items.IUpgradeModule; -import appeng.core.Configuration; +import appeng.core.AEConfig; import appeng.core.features.AEFeature; import appeng.core.features.AEFeatureHandler; import appeng.items.AEBaseItem; @@ -117,11 +117,11 @@ public class ItemMaterial extends AEBaseItem implements IStorageComponent, IUpgr { boolean enabled = true; for (AEFeature f : mat.getFeature()) - enabled = enabled && Configuration.instance.isFeatureEnabled( f ); + enabled = enabled && AEConfig.instance.isFeatureEnabled( f ); if ( enabled ) { - int newMaterialNum = Configuration.instance.get( "materials", name, Configuration.instance.getFreeMaterial() ).getInt(); + int newMaterialNum = AEConfig.instance.get( "materials", name, AEConfig.instance.getFreeMaterial() ).getInt(); mat.damageValue = newMaterialNum; ItemStack output = new ItemStack( this, 1, newMaterialNum ); output.setItemDamage( newMaterialNum ); diff --git a/items/parts/ItemPart.java b/items/parts/ItemPart.java index edc5137f..6d1af834 100644 --- a/items/parts/ItemPart.java +++ b/items/parts/ItemPart.java @@ -16,7 +16,7 @@ import appeng.api.AEApi; import appeng.api.implementations.items.IItemGroup; import appeng.api.parts.IPart; import appeng.api.parts.IPartItem; -import appeng.core.Configuration; +import appeng.core.AEConfig; import appeng.core.features.AEFeature; import appeng.core.features.AEFeatureHandler; import appeng.core.localization.GuiText; @@ -71,11 +71,11 @@ public class ItemPart extends AEBaseItem implements IPartItem, IItemGroup boolean enabled = true; for (AEFeature f : mat.getFeature()) - enabled = enabled && Configuration.instance.isFeatureEnabled( f ); + enabled = enabled && AEConfig.instance.isFeatureEnabled( f ); if ( enabled ) { - int newPartNum = Configuration.instance.get( "parts", name, Configuration.instance.getFreePart() ).getInt(); + int newPartNum = AEConfig.instance.get( "parts", name, AEConfig.instance.getFreePart() ).getInt(); ItemStack output = new ItemStack( this ); output.setItemDamage( newPartNum ); diff --git a/items/tools/powered/ToolChargedStaff.java b/items/tools/powered/ToolChargedStaff.java index 8f622007..e97d255c 100644 --- a/items/tools/powered/ToolChargedStaff.java +++ b/items/tools/powered/ToolChargedStaff.java @@ -6,7 +6,7 @@ import java.util.EnumSet; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; -import appeng.core.Configuration; +import appeng.core.AEConfig; import appeng.core.features.AEFeature; import appeng.core.sync.packets.PacketLightning; import appeng.items.tools.powered.powersink.AEBasePoweredItem; @@ -19,7 +19,7 @@ public class ToolChargedStaff extends AEBasePoweredItem public ToolChargedStaff() { super( ToolChargedStaff.class, null ); setfeature( EnumSet.of( AEFeature.ChargedStaff, AEFeature.PoweredTools ) ); - maxStoredPower = Configuration.instance.staff_battery; + maxStoredPower = AEConfig.instance.staff_battery; } @Override diff --git a/items/tools/powered/ToolEntropyManipulator.java b/items/tools/powered/ToolEntropyManipulator.java index ec394ae4..21531eb7 100644 --- a/items/tools/powered/ToolEntropyManipulator.java +++ b/items/tools/powered/ToolEntropyManipulator.java @@ -19,7 +19,7 @@ import net.minecraft.util.MovingObjectPosition.MovingObjectType; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.oredict.OreDictionary; -import appeng.core.Configuration; +import appeng.core.AEConfig; import appeng.core.features.AEFeature; import appeng.items.tools.powered.powersink.AEBasePoweredItem; import appeng.util.InWorldToolOperationResult; @@ -131,7 +131,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem public ToolEntropyManipulator() { super( ToolEntropyManipulator.class, null ); setfeature( EnumSet.of( AEFeature.EntropyManipulator, AEFeature.PoweredTools ) ); - maxStoredPower = Configuration.instance.manipulator_battery; + maxStoredPower = AEConfig.instance.manipulator_battery; coolDown = new Hashtable(); coolDown.put( new Combo( Blocks.stone, 0 ), new InWorldToolOperationResult( new ItemStack( Blocks.cobblestone ) ) ); diff --git a/items/tools/powered/ToolMassCannon.java b/items/tools/powered/ToolMassCannon.java index 0025ab32..a4aa80f1 100644 --- a/items/tools/powered/ToolMassCannon.java +++ b/items/tools/powered/ToolMassCannon.java @@ -30,7 +30,7 @@ import appeng.api.storage.data.IAEStack; import appeng.api.storage.data.IItemList; import appeng.core.AELog; import appeng.core.CommonHelper; -import appeng.core.Configuration; +import appeng.core.AEConfig; import appeng.core.features.AEFeature; import appeng.core.localization.GuiText; import appeng.core.localization.PlayerMessages; @@ -49,7 +49,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell public ToolMassCannon() { super( ToolMassCannon.class, null ); setfeature( EnumSet.of( AEFeature.MatterCannon, AEFeature.PoweredTools ) ); - maxStoredPower = Configuration.instance.mattercannon_battery; + maxStoredPower = AEConfig.instance.mattercannon_battery; } @Override @@ -223,7 +223,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell } else if ( pos.typeOfHit == MovingObjectType.BLOCK ) { - if ( !Configuration.instance.isFeatureEnabled( AEFeature.MassCannonBlockDamage ) ) + if ( !AEConfig.instance.isFeatureEnabled( AEFeature.MassCannonBlockDamage ) ) penitration = 0; else { diff --git a/items/tools/powered/ToolPortableCell.java b/items/tools/powered/ToolPortableCell.java index 024227a2..84de85b4 100644 --- a/items/tools/powered/ToolPortableCell.java +++ b/items/tools/powered/ToolPortableCell.java @@ -16,7 +16,7 @@ import appeng.api.implementations.items.IStorageCell; import appeng.api.storage.IMEInventory; import appeng.api.storage.StorageChannel; import appeng.api.storage.data.IAEItemStack; -import appeng.core.Configuration; +import appeng.core.AEConfig; import appeng.core.features.AEFeature; import appeng.core.localization.GuiText; import appeng.core.sync.GuiBridge; @@ -34,7 +34,7 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell, public ToolPortableCell() { super( ToolPortableCell.class, null ); setfeature( EnumSet.of( AEFeature.PortableCell, AEFeature.StorageCells, AEFeature.PoweredTools ) ); - maxStoredPower = Configuration.instance.portablecell_battery; + maxStoredPower = AEConfig.instance.portablecell_battery; } @Override diff --git a/items/tools/powered/ToolWirelessTerminal.java b/items/tools/powered/ToolWirelessTerminal.java index 22387636..551f84d7 100644 --- a/items/tools/powered/ToolWirelessTerminal.java +++ b/items/tools/powered/ToolWirelessTerminal.java @@ -10,7 +10,7 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import appeng.api.AEApi; import appeng.api.features.IWirelessTermHandler; -import appeng.core.Configuration; +import appeng.core.AEConfig; import appeng.core.features.AEFeature; import appeng.core.localization.GuiText; import appeng.items.tools.powered.powersink.AEBasePoweredItem; @@ -22,7 +22,7 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless public ToolWirelessTerminal() { super( ToolWirelessTerminal.class, null ); setfeature( EnumSet.of( AEFeature.WirelessAccessTerminal, AEFeature.PoweredTools ) ); - maxStoredPower = Configuration.instance.wireless_battery; + maxStoredPower = AEConfig.instance.wireless_battery; } @Override diff --git a/me/cache/SpatialPylonCache.java b/me/cache/SpatialPylonCache.java index 001f122f..023d87df 100644 --- a/me/cache/SpatialPylonCache.java +++ b/me/cache/SpatialPylonCache.java @@ -14,7 +14,7 @@ import appeng.api.networking.events.MENetworkEventSubscribe; import appeng.api.networking.spatial.ISpatialCache; import appeng.api.util.DimensionalCoord; import appeng.api.util.IReadOnlyCollection; -import appeng.core.Configuration; +import appeng.core.AEConfig; import appeng.me.cluster.implementations.SpatialPylonCluster; import appeng.tile.spatial.TileSpatialIOPort; import appeng.tile.spatial.TileSpatialPylon; @@ -159,8 +159,8 @@ public class SpatialPylonCache implements IGridCache, ISpatialCache if ( effiency < 0.0 ) effiency = 0.0; - minPower = (double) reqX * (double) reqY * reqZ * Configuration.instance.spatialPowerMultiplier; - maxPower = Math.pow( minPower, Configuration.instance.spatialPowerScaler ); + minPower = (double) reqX * (double) reqY * reqZ * AEConfig.instance.spatialPowerMultiplier; + maxPower = Math.pow( minPower, AEConfig.instance.spatialPowerScaler ); } double affective_effiency = Math.pow( effiency, 0.25 ); diff --git a/parts/p2p/PartP2PBCPower.java b/parts/p2p/PartP2PBCPower.java index 20b4663a..0a68e9cb 100644 --- a/parts/p2p/PartP2PBCPower.java +++ b/parts/p2p/PartP2PBCPower.java @@ -13,7 +13,7 @@ import appeng.api.networking.IGridNode; import appeng.api.networking.ticking.IGridTickable; import appeng.api.networking.ticking.TickRateModulation; import appeng.api.networking.ticking.TickingRequest; -import appeng.core.Configuration; +import appeng.core.AEConfig; import appeng.me.GridAccessException; import appeng.me.cache.helpers.TunnelCollection; import buildcraft.api.power.IPowerReceptor; @@ -109,7 +109,7 @@ public class PartP2PBCPower extends PartP2PTunnel implements IPo { float toPull = currentTotal * (howmuch / totalRequiredPower); float pulled = pp.useEnergy( 0, toPull, true ); - QueueTunnelDrain( PowerUnits.MJ, pulled * Configuration.TunnelPowerLoss ); + QueueTunnelDrain( PowerUnits.MJ, pulled * AEConfig.TunnelPowerLoss ); tp.receiveEnergy( Type.PIPE, pulled, o.side.getOpposite() ); } diff --git a/services/VersionChecker.java b/services/VersionChecker.java index a20c9c48..659d2068 100644 --- a/services/VersionChecker.java +++ b/services/VersionChecker.java @@ -9,7 +9,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import appeng.core.AELog; -import appeng.core.Configuration; +import appeng.core.AEConfig; public class VersionChecker implements Runnable { @@ -20,7 +20,7 @@ public class VersionChecker implements Runnable public VersionChecker() { long now = (new Date()).getTime(); - delay = (1000 * 3600 * 5) - (now - Configuration.instance.latestTimeStamp); + delay = (1000 * 3600 * 5) - (now - AEConfig.instance.latestTimeStamp); if ( delay < 1 ) delay = 1; } @@ -46,7 +46,7 @@ public class VersionChecker implements Runnable String MCVersion = cpw.mods.fml.common.Loader.instance().getMCVersionString(); URLConnection yc = url.openConnection(); - yc.setRequestProperty( "User-Agent", "AE2/" + Configuration.VERSION + " (Channel:" + Configuration.CHANNEL + "," + MCVersion.replace( " ", ":" ) + yc.setRequestProperty( "User-Agent", "AE2/" + AEConfig.VERSION + " (Channel:" + AEConfig.CHANNEL + "," + MCVersion.replace( " ", ":" ) + ")" ); BufferedReader in = new BufferedReader( new InputStreamReader( yc.getInputStream() ) ); @@ -63,9 +63,9 @@ public class VersionChecker implements Runnable Matcher m = Pattern.compile( "\"Version\":\"([^\"]+)\"" ).matcher( Version ); m.find(); Version = m.group( 1 ); - Configuration.instance.latestVersion = Version; - Configuration.instance.latestTimeStamp = (new Date()).getTime(); - Configuration.instance.save(); + AEConfig.instance.latestVersion = Version; + AEConfig.instance.latestTimeStamp = (new Date()).getTime(); + AEConfig.instance.save(); } Thread.sleep( 1000 * 3600 * 4 ); diff --git a/tile/networking/TileWireless.java b/tile/networking/TileWireless.java index 6ee0b652..e90f98fc 100644 --- a/tile/networking/TileWireless.java +++ b/tile/networking/TileWireless.java @@ -14,7 +14,7 @@ import appeng.api.networking.events.MENetworkEventSubscribe; import appeng.api.networking.events.MENetworkPowerStatusChange; import appeng.api.util.AECableType; import appeng.api.util.DimensionalCoord; -import appeng.core.Configuration; +import appeng.core.AEConfig; import appeng.me.GridAccessException; import appeng.tile.events.AETileEventHandler; import appeng.tile.events.TileEventType; @@ -132,7 +132,7 @@ public class TileWireless extends AENetworkInvTile private void updatePower() { - gridProxy.setIdlePowerUsage( Configuration.instance.wireless_getPowerDrain( getBoosters() ) ); + gridProxy.setIdlePowerUsage( AEConfig.instance.wireless_getPowerDrain( getBoosters() ) ); } @Override @@ -143,7 +143,7 @@ public class TileWireless extends AENetworkInvTile public double getRange() { - return Configuration.instance.wireless_getMaxRange( getBoosters() ); + return AEConfig.instance.wireless_getMaxRange( getBoosters() ); } private int getBoosters()