Refactoring

Type-safety

Minor performance improvements
This commit is contained in:
thatsIch
2014-11-28 04:36:46 +01:00
parent 9fae9d1ec0
commit 2243c5a188
87 changed files with 899 additions and 730 deletions
+8 -5
View File
@@ -18,6 +18,7 @@
package appeng.core;
import java.io.File;
import java.util.Arrays;
import java.util.EnumSet;
@@ -25,6 +26,12 @@ import java.util.List;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import appeng.api.config.CondenserOutput;
import appeng.api.config.PowerMultiplier;
import appeng.api.config.PowerUnits;
@@ -40,10 +47,6 @@ import appeng.items.materials.MaterialType;
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.ModContainer;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class AEConfig extends Configuration implements IConfigurableObject, IConfigManagerHost
{
@@ -156,7 +159,7 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
@SubscribeEvent
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs)
{
if ( eventArgs.modID.equals( AppEng.modid ) )
if ( eventArgs.modID.equals( AppEng.MOD_ID ) )
{
clientSync();
}
+21 -19
View File
@@ -50,24 +50,26 @@ import appeng.services.VersionChecker;
import appeng.util.Platform;
@Mod( modid = AppEng.modid, acceptedMinecraftVersions = "[1.7.10]", name = AppEng.name, version = AEConfig.VERSION, dependencies = AppEng.dependencies, guiFactory = "appeng.client.gui.config.AEConfigGuiFactory" )
@Mod( modid = AppEng.MOD_ID, acceptedMinecraftVersions = "[1.7.10]", name = AppEng.MOD_NAME, version = AEConfig.VERSION, dependencies = AppEng.MOD_DEPENDENCIES, guiFactory = "appeng.client.gui.config.AEConfigGuiFactory" )
public class AppEng
{
public final static String modid = "appliedenergistics2";
public final static String name = "Applied Energistics 2";
public final static String dependencies =
public final static String MOD_ID = "appliedenergistics2";
public final static String MOD_NAME = "Applied Energistics 2";
public final static String MOD_DEPENDENCIES =
// a few mods, AE should load after, probably.
// required-after:AppliedEnergistics2API|all;
// "after:gregtech_addon;after:Mekanism;after:IC2;after:ThermalExpansion;after:BuildCraft|Core;" +
// depend on version of forge used for build.
"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
+ net.minecraftforge.common.ForgeVersion.majorVersion + '.' // majorVersion
+ net.minecraftforge.common.ForgeVersion.minorVersion + '.' // minorVersion
+ net.minecraftforge.common.ForgeVersion.revisionVersion + '.' // revisionVersion
+ net.minecraftforge.common.ForgeVersion.buildVersion + ",)"; // buildVersion
public static AppEng instance;
private final IMCHandler imcHandler;
private String configPath;
public AppEng()
@@ -81,21 +83,21 @@ public class AppEng
public String getConfigPath()
{
return configPath;
return this.configPath;
}
public boolean isIntegrationEnabled( IntegrationType Name )
public boolean isIntegrationEnabled( IntegrationType integrationName )
{
return IntegrationRegistry.INSTANCE.isEnabled( Name );
return IntegrationRegistry.INSTANCE.isEnabled( integrationName );
}
public Object getIntegration( IntegrationType Name )
public Object getIntegration( IntegrationType integrationName )
{
return IntegrationRegistry.INSTANCE.getInstance( Name );
return IntegrationRegistry.INSTANCE.getInstance( integrationName );
}
@EventHandler
void PreInit( FMLPreInitializationEvent event )
void preInit( FMLPreInitializationEvent event )
{
if ( !Loader.isModLoaded( "appliedenergistics2-core" ) )
{
@@ -103,10 +105,10 @@ public class AppEng
}
Stopwatch star = Stopwatch.createStarted();
configPath = event.getModConfigurationDirectory().getPath() + File.separator + "AppliedEnergistics2" + File.separator;
this.configPath = event.getModConfigurationDirectory().getPath() + File.separator + "AppliedEnergistics2" + File.separator;
AEConfig.instance = new AEConfig( configPath );
FacadeConfig.instance = new FacadeConfig( configPath );
AEConfig.instance = new AEConfig( this.configPath );
FacadeConfig.instance = new FacadeConfig( this.configPath );
AELog.info( "Starting ( PreInit )" );
@@ -122,7 +124,7 @@ public class AppEng
if ( AEConfig.instance.isFeatureEnabled( AEFeature.VersionChecker ) )
{
AELog.info( "Starting VersionChecker" );
startService( "AE2 VersionChecker", new Thread( new VersionChecker() ) );
this.startService( "AE2 VersionChecker", new Thread( new VersionChecker() ) );
}
AELog.info( "PreInit ( end " + star.elapsed( TimeUnit.MILLISECONDS ) + "ms )" );
@@ -136,7 +138,7 @@ public class AppEng
}
@EventHandler
void Init( FMLInitializationEvent event )
void init( FMLInitializationEvent event )
{
Stopwatch star = Stopwatch.createStarted();
AELog.info( "Init" );
@@ -148,7 +150,7 @@ public class AppEng
}
@EventHandler
void PostInit( FMLPostInitializationEvent event )
void postInit( FMLPostInitializationEvent event )
{
Stopwatch star = Stopwatch.createStarted();
AELog.info( "PostInit" );
+59 -56
View File
@@ -28,11 +28,11 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.WeakHashMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
@@ -57,14 +57,14 @@ import appeng.services.CompassService;
public class WorldSettings extends Configuration
{
private static final String SPAWNDATA_FOLDER = "spawndata";
private static final String COMPASS_Folder = "compass";
private static final String COMPASS_FOLDER = "compass";
private static WorldSettings instance;
private final List<Integer> storageCellDims = new ArrayList<Integer>();
private final File aeFolder;
private final CompassService compass;
private final PlayerMappings mappings;
private final WeakHashMap<GridStorageSearch, WeakReference<GridStorageSearch>> loadedStorage = new WeakHashMap<GridStorageSearch, WeakReference<GridStorageSearch>>();
private final Map<GridStorageSearch, WeakReference<GridStorageSearch>> loadedStorage = new WeakHashMap<GridStorageSearch, WeakReference<GridStorageSearch>>();
private long lastGridStorage;
private int lastPlayer;
@@ -74,21 +74,21 @@ public class WorldSettings extends Configuration
this.aeFolder = aeFolder;
this.compass = new CompassService( aeFolder );
for ( int dimID : get( "DimensionManager", "StorageCells", new int[0] ).getIntList() )
for ( int dimID : this.get( "DimensionManager", "StorageCells", new int[0] ).getIntList() )
{
storageCellDims.add( dimID );
this.storageCellDims.add( dimID );
DimensionManager.registerDimension( dimID, AEConfig.instance.storageProviderID );
}
try
{
lastGridStorage = Long.parseLong( get( "Counters", "lastGridStorage", 0 ).getString() );
lastPlayer = get( "Counters", "lastPlayer", 0 ).getInt();
this.lastGridStorage = Long.parseLong( this.get( "Counters", "lastGridStorage", 0 ).getString() );
this.lastPlayer = this.get( "Counters", "lastPlayer", 0 ).getInt();
}
catch ( NumberFormatException err )
{
lastGridStorage = 0;
lastPlayer = 0;
this.lastGridStorage = 0;
this.lastPlayer = 0;
}
final ConfigCategory playerList = this.getCategory( "players" );
@@ -108,7 +108,7 @@ public class WorldSettings extends Configuration
throw new RuntimeException( "Failed to create " + aeBaseFolder.getAbsolutePath() );
}
File compass = new File( aeBaseFolder, COMPASS_Folder );
File compass = new File( aeBaseFolder, COMPASS_FOLDER );
if ( !compass.isDirectory() && !compass.mkdir() )
{
throw new RuntimeException( "Failed to create " + compass.getAbsolutePath() );
@@ -128,7 +128,7 @@ public class WorldSettings extends Configuration
public Collection<NBTTagCompound> getNearByMeteorites( int dim, int chunkX, int chunkZ )
{
LinkedList<NBTTagCompound> ll = new LinkedList<NBTTagCompound>();
Collection<NBTTagCompound> ll = new LinkedList<NBTTagCompound>();
synchronized ( WorldSettings.class )
{
@@ -139,14 +139,14 @@ public class WorldSettings extends Configuration
int cx = x + ( chunkX >> 4 );
int cz = z + ( chunkZ >> 4 );
NBTTagCompound data = loadSpawnData( dim, cx << 4, cz << 4 );
NBTTagCompound data = this.loadSpawnData( dim, cx << 4, cz << 4 );
if ( data != null )
{
// edit.
int size = data.getInteger( "num" );
for ( int s = 0; s < size; s++ )
ll.add( data.getCompoundTag( "" + s ) );
ll.add( data.getCompoundTag( String.valueOf( s ) ) );
}
}
}
@@ -161,7 +161,7 @@ public class WorldSettings extends Configuration
throw new RuntimeException( "Invalid Request" );
NBTTagCompound data = null;
File file = new File( aeFolder, SPAWNDATA_FOLDER + File.separatorChar + dim + "_" + ( chunkX >> 4 ) + "_" + ( chunkZ >> 4 ) + ".dat" );
File file = new File( this.aeFolder, SPAWNDATA_FOLDER + File.separatorChar + dim + '_' + ( chunkX >> 4 ) + '_' + ( chunkZ >> 4 ) + ".dat" );
if ( file.isFile() )
{
@@ -204,7 +204,7 @@ public class WorldSettings extends Configuration
{
synchronized ( WorldSettings.class )
{
NBTTagCompound data = loadSpawnData( dim, chunkX, chunkZ );
NBTTagCompound data = this.loadSpawnData( dim, chunkX, chunkZ );
return data.getBoolean( chunkX + "," + chunkZ );
}
}
@@ -213,12 +213,12 @@ public class WorldSettings extends Configuration
{
synchronized ( WorldSettings.class )
{
NBTTagCompound data = loadSpawnData( dim, chunkX, chunkZ );
NBTTagCompound data = this.loadSpawnData( dim, chunkX, chunkZ );
// edit.
data.setBoolean( chunkX + "," + chunkZ, true );
writeSpawnData( dim, chunkX, chunkZ, data );
this.writeSpawnData( dim, chunkX, chunkZ, data );
}
}
@@ -227,7 +227,7 @@ public class WorldSettings extends Configuration
if ( !Thread.holdsLock( WorldSettings.class ) )
throw new RuntimeException( "Invalid Request" );
File file = new File( aeFolder, SPAWNDATA_FOLDER + File.separatorChar + dim + "_" + ( chunkX >> 4 ) + "_" + ( chunkZ >> 4 ) + ".dat" );
File file = new File( this.aeFolder, SPAWNDATA_FOLDER + File.separatorChar + dim + '_' + ( chunkX >> 4 ) + '_' + ( chunkZ >> 4 ) + ".dat" );
FileOutputStream fileOutputStream = null;
try
@@ -259,14 +259,14 @@ public class WorldSettings extends Configuration
{
synchronized ( WorldSettings.class )
{
NBTTagCompound data = loadSpawnData( dim, chunkX, chunkZ );
NBTTagCompound data = this.loadSpawnData( dim, chunkX, chunkZ );
// edit.
int size = data.getInteger( "num" );
data.setTag( "" + size, newData );
data.setTag( String.valueOf( size ), newData );
data.setInteger( "num", size + 1 );
writeSpawnData( dim, chunkX, chunkZ, data );
this.writeSpawnData( dim, chunkX, chunkZ, data );
return true;
}
@@ -274,14 +274,14 @@ public class WorldSettings extends Configuration
public void shutdown()
{
save();
this.save();
for ( Integer dimID : storageCellDims )
for ( Integer dimID : this.storageCellDims )
DimensionManager.unregisterDimension( dimID );
storageCellDims.clear();
this.storageCellDims.clear();
compass.kill();
this.compass.kill();
instance = null;
}
@@ -289,47 +289,47 @@ public class WorldSettings extends Configuration
public void save()
{
// populate new data
for ( GridStorageSearch gs : loadedStorage.keySet() )
for ( GridStorageSearch gs : this.loadedStorage.keySet() )
{
GridStorage thisStorage = gs.gridStorage.get();
if ( thisStorage != null && thisStorage.getGrid() != null && !thisStorage.getGrid().isEmpty() )
{
String value = thisStorage.getValue();
get( "gridstorage", "" + thisStorage.getID(), value ).set( value );
this.get( "gridstorage", String.valueOf( thisStorage.getID() ), value ).set( value );
}
}
// save to files
if ( hasChanged() )
if ( this.hasChanged() )
super.save();
}
public void addStorageCellDim( int newDim )
{
storageCellDims.add( newDim );
this.storageCellDims.add( newDim );
DimensionManager.registerDimension( newDim, AEConfig.instance.storageProviderID );
NetworkHandler.instance.sendToAll( new PacketNewStorageDimension( newDim ) );
String[] values = new String[storageCellDims.size()];
String[] values = new String[this.storageCellDims.size()];
for ( int x = 0; x < values.length; x++ )
values[x] = "" + storageCellDims.get( x );
values[x] = String.valueOf( this.storageCellDims.get( x ) );
get( "DimensionManager", "StorageCells", new int[0] ).set( values );
save();
this.get( "DimensionManager", "StorageCells", new int[0] ).set( values );
this.save();
}
public CompassService getCompass()
{
return compass;
return this.compass;
}
public void sendToPlayer( NetworkManager manager, EntityPlayerMP player )
public void sendToPlayer( NetworkManager manager )
{
if ( manager != null )
{
for ( int newDim : get( "DimensionManager", "StorageCells", new int[0] ).getIntList() )
for ( int newDim : this.get( "DimensionManager", "StorageCells", new int[0] ).getIntList() )
{
manager.scheduleOutboundPacket( ( new PacketNewStorageDimension( newDim ) ).getProxy() );
}
@@ -343,23 +343,23 @@ public class WorldSettings extends Configuration
public void init()
{
save();
this.save();
}
public WorldCoord getStoredSize( int dim )
{
int x = get( "StorageCell" + dim, "scaleX", 0 ).getInt();
int y = get( "StorageCell" + dim, "scaleY", 0 ).getInt();
int z = get( "StorageCell" + dim, "scaleZ", 0 ).getInt();
int x = this.get( "StorageCell" + dim, "scaleX", 0 ).getInt();
int y = this.get( "StorageCell" + dim, "scaleY", 0 ).getInt();
int z = this.get( "StorageCell" + dim, "scaleZ", 0 ).getInt();
return new WorldCoord( x, y, z );
}
public void setStoredSize( int dim, int targetX, int targetY, int targetZ )
{
get( "StorageCell" + dim, "scaleX", 0 ).set( targetX );
get( "StorageCell" + dim, "scaleY", 0 ).set( targetY );
get( "StorageCell" + dim, "scaleZ", 0 ).set( targetZ );
save();
this.get( "StorageCell" + dim, "scaleX", 0 ).set( targetX );
this.get( "StorageCell" + dim, "scaleY", 0 ).set( targetY );
this.get( "StorageCell" + dim, "scaleZ", 0 ).set( targetZ );
this.save();
}
/**
@@ -372,16 +372,18 @@ public class WorldSettings extends Configuration
public GridStorage getGridStorage( long storageID )
{
GridStorageSearch gss = new GridStorageSearch( storageID );
WeakReference<GridStorageSearch> result = loadedStorage.get( gss );
WeakReference<GridStorageSearch> result = this.loadedStorage.get( gss );
if ( result == null || result.get() == null )
{
String Data = get( "gridstorage", "" + storageID, "" ).getString();
String id = String.valueOf( storageID );
String Data = this.get( "gridstorage", id, "" ).getString();
GridStorage thisStorage = new GridStorage( Data, storageID, gss );
gss.gridStorage = new WeakReference<GridStorage>( thisStorage );
loadedStorage.put( gss, new WeakReference<GridStorageSearch>( gss ) );
this.loadedStorage.put( gss, new WeakReference<GridStorageSearch>( gss ) );
return thisStorage;
}
return result.get().gridStorage.get();
}
@@ -390,24 +392,25 @@ public class WorldSettings extends Configuration
*/
public GridStorage getNewGridStorage()
{
long storageID = nextGridStorage();
long storageID = this.nextGridStorage();
GridStorageSearch gss = new GridStorageSearch( storageID );
GridStorage newStorage = new GridStorage( storageID, gss );
gss.gridStorage = new WeakReference<GridStorage>( newStorage );
loadedStorage.put( gss, new WeakReference<GridStorageSearch>( gss ) );
this.loadedStorage.put( gss, new WeakReference<GridStorageSearch>( gss ) );
return newStorage;
}
private long nextGridStorage()
{
long r = lastGridStorage++;
get( "Counters", "lastGridStorage", lastGridStorage ).set( Long.toString( lastGridStorage ) );
long r = this.lastGridStorage++;
this.get( "Counters", "lastGridStorage", this.lastGridStorage ).set( Long.toString( this.lastGridStorage ) );
return r;
}
public void destroyGridStorage( long id )
{
this.getCategory( "gridstorage" ).remove( "" + id );
String stringID = String.valueOf( id );
this.getCategory( "gridstorage" ).remove( stringID );
}
public int getNextOrderedValue( String name )
@@ -432,17 +435,17 @@ public class WorldSettings extends Configuration
return prop.getInt();
else
{
playerList.put( uuid, prop = new Property( uuid, "" + nextPlayer(), Property.Type.INTEGER ) );
playerList.put( uuid, prop = new Property( uuid, String.valueOf( this.nextPlayer() ), Property.Type.INTEGER ) );
this.mappings.put( prop.getInt(), profile.getId() ); // add to reverse map
save();
this.save();
return prop.getInt();
}
}
private long nextPlayer()
{
long r = lastPlayer++;
get( "Counters", "lastPlayer", lastPlayer ).set( lastPlayer );
long r = this.lastPlayer++;
this.get( "Counters", "lastPlayer", this.lastPlayer ).set( this.lastPlayer );
return r;
}
+19 -14
View File
@@ -18,16 +18,14 @@
package appeng.core.api;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.util.*;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
@@ -38,6 +36,15 @@ import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.MethodNode;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import com.google.common.base.Joiner;
import appeng.api.parts.CableRenderMode;
import appeng.api.parts.IPartHelper;
import appeng.api.parts.IPartItem;
@@ -52,8 +59,6 @@ import appeng.parts.PartPlacement;
import appeng.tile.networking.TileCableBus;
import appeng.util.Platform;
import com.google.common.base.Joiner;
public class ApiPart implements IPartHelper
{
@@ -112,7 +117,7 @@ public class ApiPart implements IPartHelper
try
{
ClassReader cr;
String path = "/" + name.replace( ".", "/" ) + ".class";
String path = '/' + name.replace( ".", "/" ) + ".class";
InputStream is = getClass().getResourceAsStream( path );
cr = new ClassReader( is );
ClassNode cn = new ClassNode();
@@ -139,7 +144,7 @@ public class ApiPart implements IPartHelper
}
}
String description = base + ":" + Joiner.on( ";" ).skipNulls().join( desc.iterator() );
String description = base + ':' + Joiner.on( ";" ).skipNulls().join( desc.iterator() );
if ( tileImplementations.get( description ) != null )
{
@@ -180,7 +185,7 @@ public class ApiPart implements IPartHelper
{
try
{
String newPath = path + ";" + name;
String newPath = path + ';' + name;
myCLass = getClassByDesc( Addendum, newPath, f, interfaces2Layer.get( Class.forName( name ) ) );
path = newPath;
}
@@ -232,7 +237,7 @@ public class ApiPart implements IPartHelper
try
{
n.name = n.name + "_" + Addendum;
n.name = n.name + '_' + Addendum;
n.superName = Class.forName( root ).getName().replace( ".", "/" );
}
catch (Throwable t)
@@ -31,10 +31,10 @@ public class CrashEnhancement implements ICrashCallable
private final String name;
private final String value;
private final String ModVersion = AEConfig.CHANNEL + " " + AEConfig.VERSION + " for Forge " + // WHAT?
net.minecraftforge.common.ForgeVersion.majorVersion + "." // majorVersion
+ net.minecraftforge.common.ForgeVersion.minorVersion + "." // minorVersion
+ net.minecraftforge.common.ForgeVersion.revisionVersion + "." // revisionVersion
private final String ModVersion = AEConfig.CHANNEL + ' ' + AEConfig.VERSION + " for Forge " + // WHAT?
net.minecraftforge.common.ForgeVersion.majorVersion + '.' // majorVersion
+ net.minecraftforge.common.ForgeVersion.minorVersion + '.' // minorVersion
+ net.minecraftforge.common.ForgeVersion.revisionVersion + '.' // revisionVersion
+ net.minecraftforge.common.ForgeVersion.buildVersion;
public CrashEnhancement( CrashInfo Output )
@@ -165,7 +165,7 @@ public class AEFeatureHandler implements AEItemDefinition
if ( subName.equals( "NetherQuartzTools" ) )
return name.replace( "Quartz", "NetherQuartz" );
name += "." + subName;
name += '.' + subName;
}
return name;
@@ -24,8 +24,8 @@ import com.google.common.base.Optional;
public class FeatureNameExtractor
{
private Class<?> clazz;
private Optional<String> subName;
private final Class<?> clazz;
private final Optional<String> subName;
public FeatureNameExtractor( Class<?> clazz, Optional<String> subName )
{
@@ -64,7 +64,7 @@ public class FeatureNameExtractor
return name.replace( "Quartz", "NetherQuartz" );
}
name += "." + subName;
name += '.' + subName;
}
return name;
@@ -26,7 +26,7 @@ import appeng.core.AEConfig;
public class FeaturedActiveChecker
{
private EnumSet<AEFeature> features;
private final EnumSet<AEFeature> features;
public FeaturedActiveChecker( EnumSet<AEFeature> features )
{
@@ -68,7 +68,7 @@ public enum ButtonToolTips
public String getUnlocalized()
{
return root + "." + toString();
return root + '.' + toString();
}
public String getLocal()
@@ -82,7 +82,7 @@ public enum GuiText
public String getUnlocalized()
{
return root + "." + toString();
return root + '.' + toString();
}
public String getLocal()
@@ -41,7 +41,7 @@ public enum WailaText
public String getUnlocalized()
{
return root + "." + toString();
return root + '.' + toString();
}
public String getLocal()
@@ -18,10 +18,10 @@
package appeng.core.sync.network;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.NetHandlerPlayServer;
import appeng.core.WorldSettings;
import appeng.core.sync.AppEngPacket;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
@@ -31,6 +31,9 @@ import cpw.mods.fml.common.network.FMLNetworkEvent.ServerConnectionFromClientEve
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import appeng.core.WorldSettings;
import appeng.core.sync.AppEngPacket;
public class NetworkHandler
{
@@ -78,14 +81,14 @@ public class NetworkHandler
@SubscribeEvent
public void newConnection(ServerConnectionFromClientEvent ev)
{
WorldSettings.getInstance().sendToPlayer( ev.manager, null );
WorldSettings.getInstance().sendToPlayer( ev.manager );
}
@SubscribeEvent
public void newConnection(PlayerLoggedInEvent loginEvent)
{
if ( loginEvent.player instanceof EntityPlayerMP )
WorldSettings.getInstance().sendToPlayer( null, (EntityPlayerMP) loginEvent.player );
WorldSettings.getInstance().sendToPlayer( null );
}
@SubscribeEvent