Added Feature: #0711 - Options to change font size in game.
This commit is contained in:
parent
0244bb943f
commit
0b50d23014
5 changed files with 152 additions and 29 deletions
45
client/gui/config/AEConfigGui.java
Normal file
45
client/gui/config/AEConfigGui.java
Normal file
|
@ -0,0 +1,45 @@
|
|||
package appeng.client.gui.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraftforge.common.config.ConfigCategory;
|
||||
import net.minecraftforge.common.config.ConfigElement;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import cpw.mods.fml.client.config.GuiConfig;
|
||||
import cpw.mods.fml.client.config.IConfigElement;
|
||||
|
||||
public class AEConfigGui extends GuiConfig
|
||||
{
|
||||
|
||||
private static List<IConfigElement> getConfigElements()
|
||||
{
|
||||
List<IConfigElement> list = new ArrayList<IConfigElement>();
|
||||
|
||||
for (String cat : AEConfig.instance.getCategoryNames())
|
||||
{
|
||||
if ( cat.equals( "versionchecker" ) )
|
||||
continue;
|
||||
|
||||
if ( cat.equals( "settings" ) )
|
||||
continue;
|
||||
|
||||
ConfigCategory cc = AEConfig.instance.getCategory( cat );
|
||||
|
||||
if ( cc.isChild() )
|
||||
continue;
|
||||
|
||||
ConfigElement ce = new ConfigElement( cc );
|
||||
list.add( ce );
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public AEConfigGui(GuiScreen parent) {
|
||||
super( parent, getConfigElements(), AppEng.modid, false, false, GuiConfig.getAbridgedConfigPath( AEConfig.instance.getFilePath() ) );
|
||||
}
|
||||
|
||||
}
|
36
client/gui/config/AEConfigGuiFactory.java
Normal file
36
client/gui/config/AEConfigGuiFactory.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
package appeng.client.gui.config;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import cpw.mods.fml.client.IModGuiFactory;
|
||||
|
||||
public class AEConfigGuiFactory implements IModGuiFactory
|
||||
{
|
||||
|
||||
@Override
|
||||
public void initialize(Minecraft minecraftInstance)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiScreen> mainConfigGuiClass()
|
||||
{
|
||||
return AEConfigGui.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -19,6 +19,9 @@ import appeng.core.settings.TickRates;
|
|||
import appeng.util.ConfigManager;
|
||||
import appeng.util.IConfigManagerHost;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.client.event.ConfigChangedEvent;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class AEConfig extends Configuration implements IConfigureableObject, IConfigManagerHost
|
||||
{
|
||||
|
@ -72,6 +75,20 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
|||
return WirelessBaseCost + WirelessCostMultiplier * Math.pow( boosters, 1 + boosters / 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 spatialPowerScaler = 1.5;
|
||||
public double spatialPowerMultiplier = 1500.0;
|
||||
|
||||
|
@ -98,12 +115,55 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
|||
public int staff_battery = 8000;
|
||||
|
||||
public boolean updateable = false;
|
||||
|
||||
final private File myPath;
|
||||
|
||||
@SubscribeEvent
|
||||
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs)
|
||||
{
|
||||
if ( eventArgs.modID.equals( AppEng.modid ) )
|
||||
{
|
||||
clientSync();
|
||||
}
|
||||
}
|
||||
|
||||
private void clientSync()
|
||||
{
|
||||
enableEffects = get( "Client", "enableEffects", true ).getBoolean( true );
|
||||
useLargeFonts = get( "Client", "useTerminalUseLargeFont", false ).getBoolean( false );
|
||||
|
||||
for (Enum e : settings.getSettings())
|
||||
{
|
||||
String Category = "Client"; // e.getClass().getSimpleName();
|
||||
Enum value = settings.getSetting( e );
|
||||
|
||||
Property p = this.get( Category, e.name(), value.name(), 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" );
|
||||
}
|
||||
|
||||
settings.putSetting( e, value );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String getFilePath()
|
||||
{
|
||||
return myPath.toString();
|
||||
}
|
||||
|
||||
public AEConfig(String path) {
|
||||
super( new File( path + "AppliedEnergistics2.cfg" ) );
|
||||
myPath = new File( path + "AppliedEnergistics2.cfg" );
|
||||
|
||||
FMLCommonHandler.instance().bus().register( this );
|
||||
|
||||
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;
|
||||
|
@ -123,8 +183,6 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
|||
|
||||
grinderOres = get( "GrindStone", "grinderOres", grinderOres ).getStringList();
|
||||
oreDoublePercentage = get( "GrindStone", "oreDoublePercentage", oreDoublePercentage ).getDouble( oreDoublePercentage );
|
||||
enableEffects = get( "Client", "enableEffects", true ).getBoolean( true );
|
||||
useLargeFonts = get( "Client", "useTerminalUseLargeFont", false ).getBoolean( false );
|
||||
|
||||
settings.registerSetting( Settings.SEARCH_TOOLTIPS, YesNo.YES );
|
||||
settings.registerSetting( Settings.TERMINAL_STYLE, TerminalStyle.TALL );
|
||||
|
@ -156,6 +214,8 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
|||
colorapplicator_battery = get( "battery", "colorapplicator", colorapplicator_battery ).getInt( colorapplicator_battery );
|
||||
mattercannon_battery = get( "battery", "mattercannon", mattercannon_battery ).getInt( mattercannon_battery );
|
||||
|
||||
clientSync();
|
||||
|
||||
for (AEFeature feature : AEFeature.values())
|
||||
{
|
||||
if ( feature.isVisible() )
|
||||
|
@ -170,25 +230,6 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
|||
if ( featureFlags.contains( AEFeature.WebsiteRecipes ) )
|
||||
featureFlags.add( AEFeature.DuplicateItems );
|
||||
|
||||
for (Enum e : settings.getSettings())
|
||||
{
|
||||
String Category = e.getClass().getSimpleName();
|
||||
Enum value = settings.getSetting( e );
|
||||
|
||||
Property p = this.get( Category, e.name(), value.name(), 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" );
|
||||
}
|
||||
|
||||
settings.putSetting( e, value );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
selectedPowerUnit = PowerUnits.valueOf( get( "Client", "PowerUnit", selectedPowerUnit.name(), getListComment( selectedPowerUnit ) ).getString() );
|
||||
|
@ -221,7 +262,7 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
|||
latestTimeStamp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
updateable = true;
|
||||
}
|
||||
|
||||
|
@ -370,4 +411,5 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
|||
selectedPowerUnit = Platform.rotateEnum( selectedPowerUnit, backwards, Settings.POWER_UNITS.getPossibleValues() );
|
||||
save();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,7 +39,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, acceptedMinecraftVersions = "[1.7.10]", name = AppEng.name, version = AEConfig.VERSION, dependencies = AppEng.dependencies)
|
||||
@Mod(modid = AppEng.modid, acceptedMinecraftVersions = "[1.7.10]", name = AppEng.name, version = AEConfig.VERSION, dependencies = AppEng.dependencies, guiFactory = "appeng.client.gui.config.AEConfigGuiFactory")
|
||||
public class AppEng
|
||||
{
|
||||
|
||||
|
@ -64,7 +64,7 @@ public class AppEng
|
|||
"after:gregtech_addon;after:Mekanism;after:IC2;after:ThermalExpansion;after:BuildCraft|Core;" +
|
||||
|
||||
// depend on version of forge used for build.
|
||||
"required-after:AppliedEnergistics2-Core;" + "required-after:Forge@[" // require forge.
|
||||
"required-after:appliedenergistics2-core;" + "required-after:Forge@[" // require forge.
|
||||
+ net.minecraftforge.common.ForgeVersion.majorVersion + "." // majorVersion
|
||||
+ net.minecraftforge.common.ForgeVersion.minorVersion + "." // minorVersion
|
||||
+ net.minecraftforge.common.ForgeVersion.revisionVersion + "." // revisionVersion
|
||||
|
@ -86,12 +86,12 @@ public class AppEng
|
|||
FMLCommonHandler.instance().registerCrashCallable( new CrashEnhancement( CrashInfo.MOD_VERSION ) );
|
||||
}
|
||||
|
||||
public boolean isIntegrationEnabled( IntegrationType Name )
|
||||
public boolean isIntegrationEnabled(IntegrationType Name)
|
||||
{
|
||||
return IntegrationRegistry.instance.isEnabled( Name );
|
||||
}
|
||||
|
||||
public Object getIntegration( IntegrationType Name )
|
||||
public Object getIntegration(IntegrationType Name)
|
||||
{
|
||||
return IntegrationRegistry.instance.getInstance( Name );
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public class AppEngCore extends DummyModContainer implements IFMLLoadingPlugin
|
|||
@Override
|
||||
public String getModId()
|
||||
{
|
||||
return "AppliedEnergistics2-Core";
|
||||
return "appliedenergistics2-core";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue