Moved Sorting Config Into the World.

This commit is contained in:
AlgorithmX2
2014-02-16 18:50:25 -06:00
parent 1d21f2f925
commit 646dafcc99
25 changed files with 378 additions and 52 deletions
+16 -6
View File
@@ -5,6 +5,7 @@ import java.util.Set;
import net.minecraft.nbt.NBTTagCompound;
import appeng.api.util.IConfigManager;
import appeng.core.AELog;
public class ConfigManager implements IConfigManager
{
@@ -21,18 +22,27 @@ public class ConfigManager implements IConfigManager
*
* @param tagCompound
*/
@SuppressWarnings("static-access")
@Override
public void readFromNBT(NBTTagCompound tagCompound)
{
for (Enum key : Settings.keySet())
{
String value = tagCompound.getString( key.name() );
try
{
if ( tagCompound.hasKey( key.name() ) )
{
String value = tagCompound.getString( key.name() );
Enum oldValue = Settings.get( key );
Enum newValue = oldValue.valueOf( oldValue.getClass(), value );
Enum oldValue = Settings.get( key );
Enum newValue = Enum.valueOf( oldValue.getClass(), value );
putSetting( key, newValue );
putSetting( key, newValue );
}
}
catch (IllegalArgumentException e)
{
AELog.error( e );
}
}
}
@@ -80,7 +90,7 @@ public class ConfigManager implements IConfigManager
{
Enum oldValue = getSetting( settingName );
Settings.put( settingName, newValue );
target.updateSetting( settingName, newValue );
target.updateSetting( this, settingName, newValue );
return oldValue;
}