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:
yueh
2016-11-26 14:07:34 +01:00
committed by GitHub
parent 6554e295d5
commit a665200c31
105 changed files with 1022 additions and 645 deletions
@@ -71,9 +71,9 @@ public abstract class AppEngPacket implements Packet
throw new IllegalArgumentException( "Sorry AE2 made a " + this.p.array().length + " byte packet by accident!" );
}
final FMLProxyPacket pp = new FMLProxyPacket( this.p, NetworkHandler.instance.getChannel() );
final FMLProxyPacket pp = new FMLProxyPacket( this.p, NetworkHandler.instance().getChannel() );
if( AEConfig.instance.isFeatureEnabled( AEFeature.PacketLogging ) )
if( AEConfig.instance().isFeatureEnabled( AEFeature.PACKET_LOGGING ) )
{
AELog.info( this.getClass().getName() + " : " + pp.payload().readableBytes() );
}
@@ -37,7 +37,7 @@ import appeng.core.worlddata.WorldData;
public class NetworkHandler
{
public static NetworkHandler instance;
private static NetworkHandler instance;
private final FMLEventChannel ec;
private final String myChannelName;
@@ -55,6 +55,16 @@ public class NetworkHandler
this.serveHandler = this.createServerSide();
}
public static void init( final String channelName )
{
instance = new NetworkHandler( channelName );
}
public static NetworkHandler instance()
{
return instance;
}
private IPacketHandler createClientSide()
{
try
@@ -70,7 +70,7 @@ public class PacketCompassRequest extends AppEngPacket implements ICompassCallba
@Override
public void calculatedDirection( final boolean hasResult, final boolean spin, final double radians, final double dist )
{
NetworkHandler.instance.sendTo( new PacketCompassResponse( this, hasResult, spin, radians ), (EntityPlayerMP) this.talkBackTo );
NetworkHandler.instance().sendTo( new PacketCompassResponse( this, hasResult, spin, radians ), (EntityPlayerMP) this.talkBackTo );
}
@Override
@@ -73,7 +73,7 @@ public class PacketLightning extends AppEngPacket
{
try
{
if( Platform.isClient() && AEConfig.instance.enableEffects )
if( Platform.isClient() && AEConfig.instance().isEnableEffects() )
{
final LightningFX fx = new LightningFX( ClientHelper.proxy.getWorld(), this.x, this.y, this.z, 0.0f, 0.0f, 0.0f );
Minecraft.getMinecraft().effectRenderer.addEffect( fx );