Refactored AEConfig (#2633)
Added a singleton getter instead the public field. Reduced all fields to private. Replaced field access with getters. Added setters where necessary (Dimension/Biome Registration) Added config options to disable more features. Splitted Enum name from the config key. Changed FacadeConfig and Networkhandler similar to AEConfig.init().
This commit is contained in:
@@ -168,7 +168,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||
{
|
||||
if( btn == this.craftingStatusBtn )
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_CRAFTING_STATUS ) );
|
||||
NetworkHandler.instance().sendToServer( new PacketSwitchGuis( GuiBridge.GUI_CRAFTING_STATUS ) );
|
||||
}
|
||||
|
||||
if( btn instanceof GuiImgButton )
|
||||
@@ -183,17 +183,17 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||
|
||||
if( btn == this.terminalStyleBox )
|
||||
{
|
||||
AEConfig.instance.settings.putSetting( iBtn.getSetting(), next );
|
||||
AEConfig.instance().getConfigManager().putSetting( iBtn.getSetting(), next );
|
||||
}
|
||||
else if( btn == this.searchBoxSettings )
|
||||
{
|
||||
AEConfig.instance.settings.putSetting( iBtn.getSetting(), next );
|
||||
AEConfig.instance().getConfigManager().putSetting( iBtn.getSetting(), next );
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( iBtn.getSetting().name(), next.name() ) );
|
||||
NetworkHandler.instance().sendToServer( new PacketValueConfig( iBtn.getSetting().name(), next.name() ) );
|
||||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
@@ -223,7 +223,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||
Keyboard.enableRepeatEvents( true );
|
||||
|
||||
this.maxRows = this.getMaxRows();
|
||||
this.perRow = AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ? 9 : 9 + ( ( this.width - this.standardSize ) / 18 );
|
||||
this.perRow = AEConfig.instance().getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ? 9 : 9 + ( ( this.width - this.standardSize ) / 18 );
|
||||
|
||||
final int magicNumber = 114 + 1;
|
||||
final int extraSpace = this.height - magicNumber - this.reservedSpace;
|
||||
@@ -248,7 +248,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||
}
|
||||
}
|
||||
|
||||
if( AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL )
|
||||
if( AEConfig.instance().getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL )
|
||||
{
|
||||
this.xSize = this.standardSize + ( ( this.perRow - 9 ) * 18 );
|
||||
}
|
||||
@@ -284,12 +284,12 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||
this.buttonList.add( this.SortDirBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_DIRECTION, this.configSrc.getSetting( Settings.SORT_DIRECTION ) ) );
|
||||
offset += 20;
|
||||
|
||||
this.buttonList.add( this.searchBoxSettings = new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE ) ) );
|
||||
this.buttonList.add( this.searchBoxSettings = new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE ) ) );
|
||||
offset += 20;
|
||||
|
||||
if( !( this instanceof GuiMEPortableCell ) || this instanceof GuiWirelessTerm )
|
||||
{
|
||||
this.buttonList.add( this.terminalStyleBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.TERMINAL_STYLE, AEConfig.instance.settings.getSetting( Settings.TERMINAL_STYLE ) ) );
|
||||
this.buttonList.add( this.terminalStyleBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.TERMINAL_STYLE, AEConfig.instance().getConfigManager().getSetting( Settings.TERMINAL_STYLE ) ) );
|
||||
}
|
||||
|
||||
this.searchField = new MEGuiTextField( this.fontRendererObj, this.guiLeft + Math.max( 80, this.offsetX ), this.guiTop + 4, 90, 12 );
|
||||
@@ -304,8 +304,8 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||
this.craftingStatusBtn.setHideEdge( 13 );
|
||||
}
|
||||
|
||||
// Enum setting = AEConfig.INSTANCE.getSetting( "Terminal", SearchBoxMode.class, SearchBoxMode.AUTOSEARCH );
|
||||
final Enum setting = AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE );
|
||||
// Enum setting = AEConfig.instance().getSetting( "Terminal", SearchBoxMode.class, SearchBoxMode.AUTOSEARCH );
|
||||
final Enum setting = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
|
||||
this.searchField.setFocused( SearchBoxMode.AUTOSEARCH == setting || SearchBoxMode.JEI_AUTOSEARCH == setting );
|
||||
|
||||
if( this.isSubGui() )
|
||||
@@ -354,7 +354,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||
@Override
|
||||
protected void mouseClicked( final int xCoord, final int yCoord, final int btn ) throws IOException
|
||||
{
|
||||
final Enum searchMode = AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE );
|
||||
final Enum searchMode = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
|
||||
|
||||
if( searchMode != SearchBoxMode.AUTOSEARCH && searchMode != SearchBoxMode.JEI_AUTOSEARCH )
|
||||
{
|
||||
@@ -438,7 +438,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||
|
||||
int getMaxRows()
|
||||
{
|
||||
return AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) == TerminalStyle.SMALL ? 6 : Integer.MAX_VALUE;
|
||||
return AEConfig.instance().getConfigManager().getSetting( Settings.TERMINAL_STYLE ) == TerminalStyle.SMALL ? 6 : Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
protected void repositionSlot( final AppEngSlot s )
|
||||
|
||||
Reference in New Issue
Block a user