Puts everywhere brackets

This commit is contained in:
thatsIch
2015-04-29 02:30:53 +02:00
parent 23aa8fd72d
commit 64ed05a1b4
465 changed files with 6726 additions and 14 deletions
+22
View File
@@ -174,10 +174,14 @@ public final class AEConfig extends Configuration implements IConfigurableObject
if( feature.isVisible )
{
if( this.get( "Features." + feature.category, feature.name(), feature.defaultValue ).getBoolean( feature.defaultValue ) )
{
this.featureFlags.add( feature );
}
}
else
{
this.featureFlags.add( feature );
}
}
ModContainer imb = cpw.mods.fml.common.Loader.instance().getIndexedModList().get( "ImmibisCore" );
@@ -185,7 +189,9 @@ public final class AEConfig extends Configuration implements IConfigurableObject
{
List<String> version = Arrays.asList( "59.0.0", "59.0.1", "59.0.2" );
if( version.contains( imb.getVersion() ) )
{
this.featureFlags.remove( AEFeature.AlphaPass );
}
}
try
@@ -279,9 +285,13 @@ public final class AEConfig extends Configuration implements IConfigurableObject
{
Enum eg = (Enum) Oeg;
if( comment == null )
{
comment = "Possible Values: " + eg.name();
}
else
{
comment += ", " + eg.name();
}
}
}
@@ -316,7 +326,9 @@ public final class AEConfig extends Configuration implements IConfigurableObject
if( prop != null )
{
if( !category.equals( "Client" ) )
{
prop.setRequiresMcRestart( true );
}
}
return prop;
@@ -334,7 +346,9 @@ public final class AEConfig extends Configuration implements IConfigurableObject
this.get( "Client", "PowerUnit", this.selectedPowerUnit.name(), this.getListComment( this.selectedPowerUnit ) ).set( this.selectedPowerUnit.name() );
if( this.hasChanged() )
{
super.save();
}
}
@SubscribeEvent
@@ -359,7 +373,9 @@ public final class AEConfig extends Configuration implements IConfigurableObject
public boolean useAEVersion( MaterialType mt )
{
if( this.isFeatureEnabled( AEFeature.WebsiteRecipes ) )
{
return true;
}
this.setCategoryComment( "OreCamouflage", "AE2 Automatically uses alternative ores present in your instance of MC to blend better with its surroundings, if you prefer you can disable this selectively using these flags; Its important to note, that some if these items even if enabled may not be craftable in game because other items are overriding their recipes." );
Property p = this.get( "OreCamouflage", mt.name(), true );
@@ -382,7 +398,9 @@ public final class AEConfig extends Configuration implements IConfigurableObject
}
if( this.updatable )
{
this.save();
}
}
public int getFreeMaterial( int varID )
@@ -400,7 +418,9 @@ public final class AEConfig extends Configuration implements IConfigurableObject
int thisInt = p.getInt();
if( varID == thisInt )
{
alreadyUsed = true;
}
min = Math.max( min, thisInt + 1 );
}
@@ -408,7 +428,9 @@ public final class AEConfig extends Configuration implements IConfigurableObject
if( alreadyUsed )
{
if( min < 16383 )
{
min = 16383;
}
return min;
}
+2
View File
@@ -119,7 +119,9 @@ public final class Api implements IAppEngApi
public IGridNode createGridNode( IGridBlock blk )
{
if ( Platform.isClient() )
{
throw new IllegalStateException( "Grid features for " + blk + " are server side only." );
}
return new GridNode( blk );
}
+4
View File
@@ -121,10 +121,14 @@ public final class AppEng
CreativeTab.init();
if( AEConfig.instance.isFeatureEnabled( AEFeature.Facades ) )
{
CreativeTabFacade.init();
}
if( Platform.isClient() )
{
CommonHelper.proxy.init();
}
Registration.INSTANCE.preInitialize( event );
@@ -46,7 +46,9 @@ public class FacadeConfig extends Configuration
public boolean checkEnabled( Block id, int metadata, boolean automatic )
{
if( id == null )
{
return false;
}
UniqueIdentifier blk = GameRegistry.findUniqueIdentifierFor( id );
if( blk == null )
@@ -56,7 +58,9 @@ public class FacadeConfig extends Configuration
try
{
if( f.get( Block.class ) == id )
{
return this.get( "minecraft", f.getName() + ( metadata == 0 ? "" : "." + metadata ), automatic ).getBoolean( automatic );
}
}
catch( Throwable e )
{
@@ -178,7 +178,9 @@ public final class Registration
private void registerSpatial( boolean force )
{
if( !AEConfig.instance.isFeatureEnabled( AEFeature.SpatialIO ) )
{
return;
}
AEConfig config = AEConfig.instance;
@@ -188,14 +190,18 @@ public final class Registration
{
config.storageBiomeID = Platform.findEmpty( BiomeGenBase.getBiomeGenArray() );
if( config.storageBiomeID == -1 )
{
throw new IllegalStateException( "Biome Array is full, please free up some Biome ID's or disable spatial." );
}
this.storageBiome = new BiomeGenStorage( config.storageBiomeID );
config.save();
}
if( !force && config.storageBiomeID != -1 )
{
this.storageBiome = new BiomeGenStorage( config.storageBiomeID );
}
}
if( config.storageProviderID != -1 )
@@ -208,7 +214,9 @@ public final class Registration
config.storageProviderID = -11;
while( !DimensionManager.registerProviderType( config.storageProviderID, StorageWorldProvider.class, false ) )
{
config.storageProviderID--;
}
config.save();
}
@@ -508,9 +516,13 @@ public final class Registration
ItemMultiMaterial.instance.makeUnique();
if( AEConfig.instance.isFeatureEnabled( AEFeature.CustomRecipes ) )
{
this.recipeHandler.parseRecipes( new ConfigLoader( AppEng.instance.getConfigDirectory() ), "index.recipe" );
}
else
{
this.recipeHandler.parseRecipes( new JarLoader( "/assets/appliedenergistics2/recipes/" ), "index.recipe" );
}
partHelper.registerNewLayer( "appeng.parts.layers.LayerISidedInventory", "net.minecraft.inventory.ISidedInventory" );
partHelper.registerNewLayer( "appeng.parts.layers.LayerIFluidHandler", "net.minecraftforge.fluids.IFluidHandler" );
@@ -523,7 +535,9 @@ public final class Registration
}
if( AppEng.instance.isIntegrationEnabled( IntegrationType.RF ) )
{
partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergyHandler", "cofh.api.energy.IEnergyReceiver" );
}
FMLCommonHandler.instance().bus().register( TickHandler.INSTANCE );
MinecraftForge.EVENT_BUS.register( TickHandler.INSTANCE );
@@ -685,10 +699,14 @@ public final class Registration
// add villager trading to black smiths for a few basic materials
if( AEConfig.instance.isFeatureEnabled( AEFeature.VillagerTrading ) )
{
VillagerRegistry.instance().registerVillageTradeHandler( 3, new AETrading() );
}
if( AEConfig.instance.isFeatureEnabled( AEFeature.CertusQuartzWorldGen ) )
{
GameRegistry.registerWorldGenerator( new QuartzWorldGen(), 0 );
}
if( AEConfig.instance.isFeatureEnabled( AEFeature.MeteoriteWorldGen ) )
{
@@ -146,7 +146,9 @@ public class WorldSettings extends Configuration
// edit.
int size = data.getInteger( "num" );
for( int s = 0; s < size; s++ )
{
ll.add( data.getCompoundTag( String.valueOf( s ) ) );
}
}
}
}
@@ -158,7 +160,9 @@ public class WorldSettings extends Configuration
NBTTagCompound loadSpawnData( int dim, int chunkX, int chunkZ )
{
if( !Thread.holdsLock( WorldSettings.class ) )
{
throw new IllegalStateException( "Invalid Request" );
}
NBTTagCompound data = null;
File file = new File( this.spawnDataFolder, dim + '_' + ( chunkX >> 4 ) + '_' + ( chunkZ >> 4 ) + ".dat" );
@@ -225,7 +229,9 @@ public class WorldSettings extends Configuration
void writeSpawnData( int dim, int chunkX, int chunkZ, NBTTagCompound data )
{
if( !Thread.holdsLock( WorldSettings.class ) )
{
throw new IllegalStateException( "Invalid Request" );
}
File file = new File( this.spawnDataFolder, dim + '_' + ( chunkX >> 4 ) + '_' + ( chunkZ >> 4 ) + ".dat" );
FileOutputStream fileOutputStream = null;
@@ -277,7 +283,9 @@ public class WorldSettings extends Configuration
this.save();
for( Integer dimID : this.storageCellDims )
{
DimensionManager.unregisterDimension( dimID );
}
this.storageCellDims.clear();
@@ -301,7 +309,9 @@ public class WorldSettings extends Configuration
// save to files
if( this.hasChanged() )
{
super.save();
}
}
public void addStorageCellDim( int newDim )
@@ -314,7 +324,9 @@ public class WorldSettings extends Configuration
String[] values = new String[this.storageCellDims.size()];
for( int x = 0; x < values.length; x++ )
{
values[x] = String.valueOf( this.storageCellDims.get( x ) );
}
this.get( "DimensionManager", "StorageCells", new int[0] ).set( values );
this.save();
@@ -337,7 +349,9 @@ public class WorldSettings extends Configuration
else
{
for( PlayerColor pc : TickHandler.INSTANCE.getPlayerColors().values() )
{
NetworkHandler.instance.sendToAll( pc.getPacket() );
}
}
}
@@ -427,13 +441,17 @@ public class WorldSettings extends Configuration
ConfigCategory playerList = this.getCategory( "players" );
if( playerList == null || profile == null || !profile.isComplete() )
{
return -1;
}
String uuid = profile.getId().toString();
Property prop = playerList.get( uuid );
if( prop != null && prop.isIntValue() )
{
return prop.getInt();
}
else
{
playerList.put( uuid, prop = new Property( uuid, String.valueOf( this.nextPlayer() ), Property.Type.INTEGER ) );
@@ -461,7 +479,9 @@ public class WorldSettings extends Configuration
for( EntityPlayer player : CommonHelper.proxy.getPlayers() )
{
if( player.getUniqueID().equals( uuid ) )
{
return player;
}
}
}
@@ -74,7 +74,9 @@ public class ApiPart implements IPartHelper
for( Class layerInterface : this.interfaces2Layer.keySet() )
{
if( AppEng.instance.isIntegrationEnabled( IntegrationType.FMP ) )
{
( (IFMP) AppEng.instance.getIntegration( IntegrationType.FMP ) ).registerPassThrough( layerInterface );
}
}
}
@@ -147,7 +149,9 @@ public class ApiPart implements IPartHelper
public Class getClassByDesc( String Addendum, String fullPath, String root, String next )
{
if( this.roots.get( fullPath ) != null )
{
return this.roots.get( fullPath );
}
ClassWriter cw = new ClassWriter( ClassWriter.COMPUTE_MAXS );
ClassNode n = this.getReader( next );
@@ -313,7 +317,9 @@ public class ApiPart implements IPartHelper
return true;
}
else
{
AELog.info( "Layer " + layer + " not registered, " + layerInterface + " already has a layer." );
}
}
catch( Throwable ignored )
{
@@ -326,7 +332,9 @@ public class ApiPart implements IPartHelper
public void setItemBusRenderer( IPartItem i )
{
if( Platform.isClient() && i instanceof Item )
{
MinecraftForgeClient.registerItemRenderer( (Item) i, BusRenderer.INSTANCE );
}
}
@Override
@@ -351,7 +359,9 @@ public class ApiPart implements IPartHelper
{
String o = this.inputOutput.get( typeName );
if( o == null )
{
return typeName;
}
return o;
}
}
@@ -77,10 +77,14 @@ public class IMCGrinder implements IIMCProcessor
int turns = msg.getInteger( "turns" );
if( in == null )
{
throw new IllegalStateException( "invalid input" );
}
if( out == null )
{
throw new IllegalStateException( "invalid output" );
}
if( msg.hasKey( "optional" ) )
{
@@ -88,13 +92,17 @@ public class IMCGrinder implements IIMCProcessor
ItemStack optional = ItemStack.loadItemStackFromNBT( optionalTag );
if( optional == null )
{
throw new IllegalStateException( "invalid optional" );
}
float chance = msg.getFloat( "chance" );
AEApi.instance().registries().grinder().addRecipe( in, out, optional, chance, turns );
}
else
{
AEApi.instance().registries().grinder().addRecipe( in, out, turns );
}
}
}
@@ -54,7 +54,9 @@ public class IMCMatterCannon implements IIMCProcessor
double weight = msg.getDouble( "weight" );
if( ammo == null )
{
throw new IllegalStateException( "invalid item in message " + m );
}
AEApi.instance().registries().matterCannon().registerAmmo( ammo, weight );
}
@@ -55,11 +55,17 @@ public class IMCP2PAttunement implements IIMCProcessor
{
ItemStack is = m.getItemStackValue();
if( is != null )
{
AEApi.instance().registries().p2pTunnel().addNewAttunement( is, type );
}
else
{
throw new IllegalStateException( "invalid item in message " + m );
}
}
else
{
throw new IllegalStateException( "invalid type in message " + m + " is not contained in " + Arrays.toString( TunnelType.values() ) );
}
}
}
@@ -50,7 +50,9 @@ public final class ColoredItemDefinition implements AEColoredItemDefinition
ItemStackSrc is = this.colors[color.ordinal()];
if( is == null )
{
return null;
}
return is.item;
}
@@ -67,7 +69,9 @@ public final class ColoredItemDefinition implements AEColoredItemDefinition
ItemStackSrc is = this.colors[color.ordinal()];
if( is == null )
{
return null;
}
return is.stack( stackSize );
}
@@ -77,7 +81,9 @@ public final class ColoredItemDefinition implements AEColoredItemDefinition
{
ItemStack[] is = new ItemStack[this.colors.length];
for( int x = 0; x < is.length; x++ )
{
is[x] = this.colors[x].stack( 1 );
}
return is;
}
@@ -87,7 +93,9 @@ public final class ColoredItemDefinition implements AEColoredItemDefinition
ItemStackSrc is = this.colors[color.ordinal()];
if( comparableItem == null || is == null )
{
return false;
}
return comparableItem.getItem() == is.item && comparableItem.getItemDamage() == is.damage;
}
@@ -57,7 +57,9 @@ public final class DamagedItemDefinition implements IItemDefinition
public boolean isSameAs( ItemStack comparableStack )
{
if( comparableStack == null )
{
return false;
}
return comparableStack.getItem() == this.source.getItem() && comparableStack.getItemDamage() == this.source.getDamage();
}
@@ -49,10 +49,14 @@ public class ItemStackSrc implements IStackSrc
public ItemStack stack( int i )
{
if( this.block != null )
{
return new ItemStack( this.block, i, this.damage );
}
if( this.item != null )
{
return new ItemStack( this.item, i, this.damage );
}
return null;
}
@@ -51,21 +51,31 @@ public final class NameResolver
String name = this.withOriginalName.getSimpleName();
if( name.startsWith( "ItemMultiPart" ) )
{
name = ITEM_MULTI_PART.matcher( name ).replaceAll( "ItemPart" );
}
else if( name.startsWith( "ItemMultiMaterial" ) )
{
name = ITEM_MULTI_MATERIAL.matcher( name ).replaceAll( "ItemMaterial" );
}
if( subName != null )
{
// simple hack to allow me to do get nice names for these without
// mode code outside of AEBaseItem
if( subName.startsWith( "P2PTunnel" ) )
{
return "ItemPart.P2PTunnel";
}
if( subName.equals( "CertusQuartzTools" ) )
{
return QUARTZ.matcher( name ).replaceAll( "CertusQuartz" );
}
if( subName.equals( "NetherQuartzTools" ) )
{
return QUARTZ.matcher( name ).replaceAll( "NetherQuartz" );
}
name += '.' + subName;
}
@@ -79,7 +79,9 @@ public final class WrappedDamageItemDefinition implements ITileDefinition
public boolean isSameAs( ItemStack comparableStack )
{
if( comparableStack == null )
{
return false;
}
return this.definition.isSameAs( comparableStack ) && comparableStack.getItemDamage() == this.damage;
}
@@ -45,17 +45,25 @@ public class CellRegistry implements ICellRegistry
public void addCellHandler( ICellHandler h )
{
if( h != null )
{
this.handlers.add( h );
}
}
@Override
public boolean isCellHandled( ItemStack is )
{
if( is == null )
{
return false;
}
for( ICellHandler ch : this.handlers )
{
if( ch.isCell( is ) )
{
return true;
}
}
return false;
}
@@ -63,7 +71,9 @@ public class CellRegistry implements ICellRegistry
public ICellHandler getHandler( ItemStack is )
{
if( is == null )
{
return null;
}
for( ICellHandler ch : this.handlers )
{
if( ch.isCell( is ) )
@@ -78,7 +88,9 @@ public class CellRegistry implements ICellRegistry
public IMEInventoryHandler getCellInventory( ItemStack is, ISaveProvider container, StorageChannel chan )
{
if( is == null )
{
return null;
}
for( ICellHandler ch : this.handlers )
{
if( ch.isCell( is ) )
@@ -55,11 +55,15 @@ public class ExternalStorageRegistry implements IExternalStorageRegistry
for( IExternalStorageHandler x : this.Handlers )
{
if( x.canHandle( te, d, chan, mySrc ) )
{
return x;
}
}
if( this.lastHandler.canHandle( te, d, chan, mySrc ) )
{
return this.lastHandler;
}
return null;
}
@@ -38,9 +38,13 @@ public final class GridCacheRegistry implements IGridCacheRegistry
public void registerGridCache( Class<? extends IGridCache> iface, Class<? extends IGridCache> implementation )
{
if( iface.isAssignableFrom( implementation ) )
{
this.caches.put( iface, implementation );
}
else
{
throw new IllegalArgumentException( "Invalid setup, grid cache must either be the same class, or an interface that the implementation implements. Gotten: " + iface + " and " + implementation );
}
}
@Override
@@ -124,8 +124,12 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
private void injectRecipe( AppEngGrinderRecipe appEngGrinderRecipe )
{
for( IGrinderEntry gr : this.recipes )
{
if( Platform.isSameItemPrecise( gr.getInput(), appEngGrinderRecipe.getInput() ) )
{
return;
}
}
this.recipes.add( appEngGrinderRecipe );
}
@@ -133,7 +137,9 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
private ItemStack copy( ItemStack is )
{
if( is != null )
{
return is.copy();
}
return null;
}
@@ -166,18 +172,26 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
private int getDustToOreRatio( String name )
{
if( name.equals( "Obsidian" ) )
{
return 1;
}
if( name.equals( "Charcoal" ) )
{
return 1;
}
if( name.equals( "Coal" ) )
{
return 1;
}
return 2;
}
private void addOre( String name, ItemStack item )
{
if( item == null )
{
return;
}
this.log( "Adding Ore - " + name + " : " + Platform.getItemDisplayName( item ) );
this.ores.put( item, name );
@@ -193,14 +207,18 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
this.addRecipe( item, is, extra, (float) ( AEConfig.instance.oreDoublePercentage / 100.0 ), 8 );
}
else
{
this.addRecipe( item, is, 8 );
}
}
}
private void addIngot( String name, ItemStack item )
{
if( item == null )
{
return;
}
this.log( "Adding Ingot - " + name + " : " + Platform.getItemDisplayName( item ) );
this.ingots.put( item, name );
@@ -214,7 +232,9 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
private void addDust( String name, ItemStack item )
{
if( item == null )
{
return;
}
if( this.dusts.containsKey( name ) )
{
this.log( "Rejecting Dust - " + name + " : " + Platform.getItemDisplayName( item ) );
@@ -226,6 +246,7 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
this.dusts.put( name, item );
for( Entry<ItemStack, String> d : this.ores.entrySet() )
{
if( name.equals( d.getValue() ) )
{
ItemStack is = item.copy();
@@ -238,12 +259,19 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
this.addRecipe( d.getKey(), is, extra, (float) ( AEConfig.instance.oreDoublePercentage / 100.0 ), 8 );
}
else
{
this.addRecipe( d.getKey(), is, 8 );
}
}
}
for( Entry<ItemStack, String> d : this.ingots.entrySet() )
{
if( name.equals( d.getValue() ) )
{
this.addRecipe( d.getKey(), item, 4 );
}
}
}
@Override
@@ -68,7 +68,9 @@ public final class InscriberRegistry implements IInscriberRegistry
public void addRecipe( IInscriberRecipe recipe )
{
if( recipe == null )
{
throw new IllegalArgumentException( "Tried to add an invalid (null) inscriber recipe to the registry." );
}
this.recipes.add( recipe );
@@ -154,15 +156,25 @@ public final class InscriberRegistry implements IInscriberRegistry
public IInscriberRecipe build()
{
if( this.inputs == null )
{
throw new IllegalStateException( "Input must be defined." );
}
if( this.inputs.size() == 0 )
{
throw new IllegalStateException( "Input must have a size." );
}
if( this.output == null )
{
throw new IllegalStateException( "Output must be defined." );
}
if ( this.topOptional == null && this.bottomOptional == null )
{
throw new IllegalStateException( "One optional must be defined." );
}
if ( this.type == null )
{
throw new IllegalStateException( "Process type must be defined." );
}
return new InscriberRecipe( this.inputs, this.output, this.topOptional, this.bottomOptional, this.type );
}
@@ -47,7 +47,9 @@ public final class LocatableRegistry implements ILocatableRegistry
public void updateLocatable( LocatableEventAnnounce e )
{
if( Platform.isClient() )
{
return; // IGNORE!
}
if( e.change == LocatableEvent.Register )
{
@@ -53,7 +53,9 @@ public class MatterCannonAmmoRegistry implements IOreListener, IMatterCannonAmmo
for( ItemStack o : this.DamageModifiers.keySet() )
{
if( Platform.isSameItem( o, is ) )
{
return this.DamageModifiers.get( o ).floatValue();
}
}
return 0;
}
@@ -62,7 +64,9 @@ public class MatterCannonAmmoRegistry implements IOreListener, IMatterCannonAmmo
public void oreRegistered( String name, ItemStack item )
{
if( !( name.startsWith( "berry" ) || name.startsWith( "nugget" ) ) )
{
return;
}
// addNugget( "Cobble", 18 ); // ?
this.considerItem( name, item, "MeatRaw", 32 );
@@ -69,12 +69,16 @@ public class MovableTileRegistry implements IMovableRegistry
IMovableHandler canMove = this.Valid.get( myClass );
if( canMove == null )
{
canMove = this.testClass( myClass, te );
}
if( canMove != this.nullHandler )
{
if( te instanceof IMovableTile )
{
( (IMovableTile) te ).prepareToMove();
}
te.invalidate();
return true;
@@ -115,7 +115,9 @@ public class P2PTunnelRegistry implements IP2PTunnelRegistry
public void addNewAttunement( ItemStack trigger, TunnelType type )
{
if( type == null || trigger == null )
{
return;
}
this.Tunnels.put( trigger, type );
}
@@ -125,7 +127,9 @@ public class P2PTunnelRegistry implements IP2PTunnelRegistry
ItemStack myItemStack = GameRegistry.findItemStack( modID, Name, 1 );
if( myItemStack == null )
{
return null;
}
myItemStack.setItemDamage( meta );
return myItemStack;
@@ -145,15 +149,21 @@ public class P2PTunnelRegistry implements IP2PTunnelRegistry
if( trigger != null )
{
if( FluidContainerRegistry.isContainer( trigger ) )
{
return TunnelType.FLUID;
}
for( ItemStack is : this.Tunnels.keySet() )
{
if( is.getItem() == trigger.getItem() && is.getItemDamage() == OreDictionary.WILDCARD_VALUE )
{
return this.Tunnels.get( is );
}
if( Platform.isSameItem( is, trigger ) )
{
return this.Tunnels.get( is );
}
}
}
@@ -53,7 +53,9 @@ public class RecipeHandlerRegistry implements IRecipeHandlerRegistry
{
Class<? extends ICraftHandler> clz = this.handlers.get( name );
if( clz == null )
{
return null;
}
try
{
return clz.newInstance();
@@ -90,7 +92,9 @@ public class RecipeHandlerRegistry implements IRecipeHandlerRegistry
}
if( rr != null )
{
return rr;
}
}
return null;
@@ -48,7 +48,9 @@ public final class WirelessRegistry implements IWirelessTermRegistry
public void registerWirelessHandler( IWirelessTermHandler handler )
{
if( handler != null )
{
this.handlers.add( handler );
}
}
@Override
@@ -57,7 +59,9 @@ public final class WirelessRegistry implements IWirelessTermRegistry
for( IWirelessTermHandler h : this.handlers )
{
if( h.canHandle( is ) )
{
return true;
}
}
return false;
}
@@ -68,7 +72,9 @@ public final class WirelessRegistry implements IWirelessTermRegistry
for( IWirelessTermHandler h : this.handlers )
{
if( h.canHandle( is ) )
{
return h;
}
}
return null;
}
@@ -77,7 +83,9 @@ public final class WirelessRegistry implements IWirelessTermRegistry
public void openWirelessTerminalGui( ItemStack item, World w, EntityPlayer player )
{
if( Platform.isClient() )
{
return;
}
if( !this.isWirelessTerminal( item ) )
{
@@ -106,6 +114,8 @@ public final class WirelessRegistry implements IWirelessTermRegistry
Platform.openGUI( player, null, null, GuiBridge.GUI_WIRELESS_TERM );
}
else
{
player.addChatMessage( PlayerMessages.DeviceNotPowered.get() );
}
}
}
@@ -48,10 +48,14 @@ public final class WorldGenRegistry implements IWorldGen
public void disableWorldGenForProviderID( WorldGenType type, Class<? extends WorldProvider> provider )
{
if( type == null )
{
throw new IllegalArgumentException( "Bad Type Passed" );
}
if( provider == null )
{
throw new IllegalArgumentException( "Bad Provider Passed" );
}
this.types[type.ordinal()].badProviders.add( provider );
}
@@ -60,7 +64,9 @@ public final class WorldGenRegistry implements IWorldGen
public void enableWorldGenForDimension( WorldGenType type, int dimensionID )
{
if( type == null )
{
throw new IllegalArgumentException( "Bad Type Passed" );
}
this.types[type.ordinal()].enabledDimensions.add( dimensionID );
}
@@ -80,10 +86,14 @@ public final class WorldGenRegistry implements IWorldGen
public boolean isWorldGenEnabled( WorldGenType type, World w )
{
if( type == null )
{
throw new IllegalArgumentException( "Bad Type Passed" );
}
if( w == null )
{
throw new IllegalArgumentException( "Bad Provider Passed" );
}
boolean isBadProvider = this.types[type.ordinal()].badProviders.contains( w.provider.getClass() );
boolean isBadDimension = this.types[type.ordinal()].badDimensions.contains( w.provider.dimensionId );
@@ -52,7 +52,9 @@ public class BasicCellHandler implements ICellHandler
public IMEInventoryHandler getCellInventory( ItemStack is, ISaveProvider container, StorageChannel channel )
{
if( channel == StorageChannel.ITEMS )
{
return CellInventory.getCell( is, container );
}
return null;
}
@@ -50,7 +50,9 @@ public class CreativeCellHandler implements ICellHandler
public IMEInventoryHandler getCellInventory( ItemStack is, ISaveProvider container, StorageChannel channel )
{
if( channel == StorageChannel.ITEMS && is != null && is.getItem() instanceof ItemCreativeStorageCell )
{
return CreativeCellInventory.getCell( is );
}
return null;
}
@@ -46,7 +46,9 @@ public class ExternalIInv implements IExternalStorageHandler
InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, d );
if( channel == StorageChannel.ITEMS && ad != null )
{
return new MEMonitorIInventory( ad );
}
return null;
}
@@ -90,20 +90,32 @@ public class InscriberRecipe implements IInscriberRecipe
public boolean equals( Object o )
{
if( this == o )
{
return true;
}
if( !(o instanceof IInscriberRecipe) )
{
return false;
}
IInscriberRecipe that = (IInscriberRecipe) o;
if( !this.inputs.equals( that.getInputs() ) )
{
return false;
}
if( !this.output.equals( that.getOutput() ) )
{
return false;
}
if( !this.maybeTop.equals( that.getTopOptional() ) )
{
return false;
}
if( !this.maybeBot.equals( that.getBottomOptional()) )
{
return false;
}
return this.type == that.getProcessType();
}
@@ -45,7 +45,9 @@ public class AchievementCraftingHandler
public void onPlayerCraftingEvent( PlayerEvent.ItemCraftedEvent event )
{
if( this.differentiator.isNoPlayer( event.player ) || event.crafting == null )
{
return;
}
for( Achievements achievement : Achievements.values() )
{
@@ -47,7 +47,9 @@ public class AchievementPickupHandler
public void onItemPickUp( PlayerEvent.ItemPickupEvent event )
{
if( this.differentiator.isNoPlayer( event.player ) || event.pickedUp == null || event.pickedUp.getEntityItem() == null )
{
return;
}
ItemStack is = event.pickedUp.getEntityItem();
@@ -86,7 +86,9 @@ public class PlayerStatsRegistration
hierarchy.registerAchievementHierarchy();
for( Stats s : Stats.values() )
{
s.getStat();
}
/**
* register
@@ -97,7 +99,9 @@ public class PlayerStatsRegistration
{
Achievement ach = a.getAchievement();
if( ach != null )
{
list.add( ach );
}
}
AchievementPage ae2AchievementPage = new AchievementPage( "Applied Energistics 2", list.toArray( new Achievement[list.size()] ) );
@@ -62,12 +62,16 @@ public abstract class AppEngPacket
public FMLProxyPacket getProxy()
{
if( this.p.array().length > 2 * 1024 * 1024 ) // 2k walking room :)
{
throw new IllegalArgumentException( "Sorry AE2 made a " + this.p.array().length + " byte packet by accident!" );
}
FMLProxyPacket pp = new FMLProxyPacket( this.p, NetworkHandler.instance.getChannel() );
if( AEConfig.instance.isFeatureEnabled( AEFeature.PacketLogging ) )
{
AELog.info( this.getClass().getName() + " : " + pp.payload().readableBytes() );
}
return pp;
}
@@ -130,7 +130,9 @@ public class AppEngPacketHandlerBase
REVERSE_LOOKUP.put( this.packetClass, this );
if( this.packetConstructor == null )
{
throw new IllegalStateException( "Invalid Packet Class " + c + ", must be constructable on DataInputStream" );
}
}
public static PacketTypes getPacket( int id )
@@ -228,10 +228,14 @@ public enum GuiBridge implements IGuiHandler
String guiClass = start.replaceFirst( "container.", "client.gui." ).replace( ".Container", ".Gui" );
if( start.equals( guiClass ) )
{
throw new IllegalStateException( "Unable to find gui class" );
}
this.Gui = ReflectionHelper.getClass( this.getClass().getClassLoader(), guiClass );
if( this.Gui == null )
{
throw new IllegalStateException( "Cannot Load class: " + guiClass );
}
}
}
@@ -263,7 +267,9 @@ public enum GuiBridge implements IGuiHandler
}
Object myItem = this.getGuiObject( it, player, w, x, y, z );
if( myItem != null && ID.CorrectTileOrPart( myItem ) )
{
return this.updateGui( ID.ConstructContainer( player.inventory, side, myItem ), w, x, y, z, side, myItem );
}
}
if( ID.type.isTile() )
{
@@ -273,12 +279,16 @@ public enum GuiBridge implements IGuiHandler
( (IPartHost) TE ).getPart( side );
IPart part = ( (IPartHost) TE ).getPart( side );
if( ID.CorrectTileOrPart( part ) )
{
return this.updateGui( ID.ConstructContainer( player.inventory, side, part ), w, x, y, z, side, part );
}
}
else
{
if( ID.CorrectTileOrPart( TE ) )
{
return this.updateGui( ID.ConstructContainer( player.inventory, side, TE ), w, x, y, z, side, TE );
}
}
}
return new ContainerNull();
@@ -295,7 +305,9 @@ public enum GuiBridge implements IGuiHandler
IWirelessTermHandler wh = AEApi.instance().registries().wireless().getWirelessTerminalHandler( it );
if( wh != null )
{
return new WirelessTerminalGuiObject( wh, it, player, w, x, y, z );
}
}
return null;
@@ -304,7 +316,9 @@ public enum GuiBridge implements IGuiHandler
public boolean CorrectTileOrPart( Object tE )
{
if( this.Tile == null )
{
throw new IllegalArgumentException( "This Gui Cannot use the standard Handler." );
}
return this.Tile.isInstance( tE );
}
@@ -331,7 +345,9 @@ public enum GuiBridge implements IGuiHandler
{
Constructor[] c = this.Container.getConstructors();
if( c.length == 0 )
{
throw new AppEngException( "Invalid Gui Class" );
}
Constructor target = this.findConstructor( c, inventory, tE );
@@ -376,7 +392,9 @@ public enum GuiBridge implements IGuiHandler
if( types.length == 2 )
{
if( types[0].isAssignableFrom( inventory.getClass() ) && types[1].isAssignableFrom( tE.getClass() ) )
{
return con;
}
}
}
return null;
@@ -385,7 +403,9 @@ public enum GuiBridge implements IGuiHandler
private String typeName( Object inventory )
{
if( inventory == null )
{
return "NULL";
}
return inventory.getClass().getName();
}
@@ -429,7 +449,9 @@ public enum GuiBridge implements IGuiHandler
}
Object myItem = this.getGuiObject( it, player, w, x, y, z );
if( myItem != null && ID.CorrectTileOrPart( myItem ) )
{
return ID.ConstructGui( player.inventory, side, myItem );
}
}
if( ID.type.isTile() )
{
@@ -439,12 +461,16 @@ public enum GuiBridge implements IGuiHandler
( (IPartHost) TE ).getPart( side );
IPart part = ( (IPartHost) TE ).getPart( side );
if( ID.CorrectTileOrPart( part ) )
{
return ID.ConstructGui( player.inventory, side, part );
}
}
else
{
if( ID.CorrectTileOrPart( TE ) )
{
return ID.ConstructGui( player.inventory, side, TE );
}
}
}
return new GuiNull( new ContainerNull() );
@@ -456,7 +482,9 @@ public enum GuiBridge implements IGuiHandler
{
Constructor[] c = this.Gui.getConstructors();
if( c.length == 0 )
{
throw new AppEngException( "Invalid Gui Class" );
}
Constructor target = this.findConstructor( c, inventory, tE );
@@ -500,12 +528,16 @@ public enum GuiBridge implements IGuiHandler
( (IPartHost) TE ).getPart( side );
IPart part = ( (IPartHost) TE ).getPart( side );
if( this.CorrectTileOrPart( part ) )
{
return this.securityCheck( part, player );
}
}
else
{
if( this.CorrectTileOrPart( TE ) )
{
return this.securityCheck( TE, player );
}
}
}
}
@@ -535,7 +567,9 @@ public enum GuiBridge implements IGuiHandler
ISecurityGrid sg = g.getCache( ISecurityGrid.class );
if( sg.hasPermission( player, this.requiredPermission ) )
{
return true;
}
}
}
@@ -90,7 +90,9 @@ public class NetworkHandler
public void newConnection( PlayerLoggedInEvent loginEvent )
{
if( loginEvent.player instanceof EntityPlayerMP )
{
WorldSettings.getInstance().sendToPlayer( null );
}
}
@SubscribeEvent
@@ -98,14 +100,18 @@ public class NetworkHandler
{
NetHandlerPlayServer srv = (NetHandlerPlayServer) ev.packet.handler();
if( this.serveHandler != null )
{
this.serveHandler.onPacketData( null, ev.packet, srv.playerEntity );
}
}
@SubscribeEvent
public void clientPacket( ClientCustomPacketEvent ev )
{
if( this.clientHandler != null )
{
this.clientHandler.onPacketData( null, ev.packet, null );
}
}
public String getChannel()
@@ -68,7 +68,9 @@ public class PacketCompressedNBT extends AppEngPacket
public int read() throws IOException
{
if( stream.readableBytes() <= 0 )
{
return -1;
}
return stream.readByte() & 0xff;
}
@@ -111,6 +113,8 @@ public class PacketCompressedNBT extends AppEngPacket
GuiScreen gs = Minecraft.getMinecraft().currentScreen;
if( gs instanceof GuiInterfaceTerminal )
{
( (GuiInterfaceTerminal) gs ).postUpdate( this.in );
}
}
}
@@ -82,11 +82,15 @@ public class PacketCraftRequest extends AppEngPacket
IGridHost gh = (IGridHost) target;
IGridNode gn = gh.getGridNode( ForgeDirection.UNKNOWN );
if( gn == null )
{
return;
}
IGrid g = gn.getGrid();
if( g == null || cca.whatToMake == null )
{
return;
}
Future<ICraftingJob> futureJob = null;
@@ -115,7 +119,9 @@ public class PacketCraftRequest extends AppEngPacket
catch( Throwable e )
{
if( futureJob != null )
{
futureJob.cancel( true );
}
AELog.error( e );
}
}
@@ -57,9 +57,13 @@ public class PacketInventoryAction extends AppEngPacket
this.id = stream.readLong();
boolean hasItem = stream.readBoolean();
if( hasItem )
{
this.slotItem = AEItemStack.loadItemStackFromPacket( stream );
}
else
{
this.slotItem = null;
}
}
// api
@@ -67,7 +71,9 @@ public class PacketInventoryAction extends AppEngPacket
{
if( Platform.isClient() )
{
throw new IllegalStateException( "invalid packet, client cannot post inv actions with stacks." );
}
this.action = action;
this.slot = slot;
@@ -82,7 +88,9 @@ public class PacketInventoryAction extends AppEngPacket
data.writeLong( this.id );
if( slotItem == null )
{
data.writeBoolean( false );
}
else
{
data.writeBoolean( true );
@@ -153,9 +161,13 @@ public class PacketInventoryAction extends AppEngPacket
if( this.action == InventoryAction.UPDATE_HAND )
{
if( this.slotItem == null )
{
ClientHelper.proxy.getPlayers().get( 0 ).inventory.setItemStack( null );
}
else
{
ClientHelper.proxy.getPlayers().get( 0 ).inventory.setItemStack( this.slotItem.getItemStack() );
}
}
}
}
@@ -88,7 +88,9 @@ public class PacketMEInventoryUpdate extends AppEngPacket
public int read() throws IOException
{
if( stream.readableBytes() <= 0 )
{
return -1;
}
return stream.readByte() & STREAM_MASK;
}
@@ -100,7 +102,9 @@ public class PacketMEInventoryUpdate extends AppEngPacket
{
int bytes = gzReader.read( tmp );
if( bytes > 0 )
{
uncompressed.writeBytes( tmp, 0, bytes );
}
}
gzReader.close();
@@ -108,7 +112,9 @@ public class PacketMEInventoryUpdate extends AppEngPacket
// AELog.info( "Receiver: " + originalBytes + " -> " + uncompressedBytes );
while( uncompressed.readableBytes() > 0 )
{
this.list.add( AEItemStack.loadItemStackFromPacket( uncompressed ) );
}
this.empty = this.list.isEmpty();
}
@@ -146,16 +152,24 @@ public class PacketMEInventoryUpdate extends AppEngPacket
GuiScreen gs = Minecraft.getMinecraft().currentScreen;
if( gs instanceof GuiCraftConfirm )
{
( (GuiCraftConfirm) gs ).postUpdate( this.list, this.ref );
}
if( gs instanceof GuiCraftingCPU )
{
( (GuiCraftingCPU) gs ).postUpdate( this.list, this.ref );
}
if( gs instanceof GuiMEMonitorable )
{
( (GuiMEMonitorable) gs ).postUpdate( this.list );
}
if( gs instanceof GuiNetworkStatus )
{
( (GuiNetworkStatus) gs ).postUpdate( this.list );
}
}
@Nullable
@@ -121,7 +121,9 @@ public class PacketNEIRecipe extends AppEngPacket
{
IGrid grid = node.getGrid();
if( grid == null )
{
return;
}
IStorageGrid inv = grid.getCache( IStorageGrid.class );
IEnergyGrid energy = grid.getCache( IEnergyGrid.class );
@@ -172,9 +174,13 @@ public class PacketNEIRecipe extends AppEngPacket
{
IAEItemStack out = realForFake == Actionable.SIMULATE ? null : Platform.poweredInsert( energy, storage, in, cct.getSource() );
if( out != null )
{
craftMatrix.setInventorySlotContents( x, out.getItemStack() );
}
else
{
craftMatrix.setInventorySlotContents( x, null );
}
currentItem = craftMatrix.getStackInSlot( x );
}
@@ -54,7 +54,9 @@ public class PacketPatternSlot extends AppEngPacket
this.slotItem = this.readItem( stream );
for( int x = 0; x < 9; x++ )
{
this.pattern[x] = this.readItem( stream );
}
}
public IAEItemStack readItem( ByteBuf stream ) throws IOException
@@ -62,7 +64,9 @@ public class PacketPatternSlot extends AppEngPacket
boolean hasItem = stream.readBoolean();
if( hasItem )
{
return AEItemStack.loadItemStackFromPacket( stream );
}
return null;
}
@@ -93,7 +97,9 @@ public class PacketPatternSlot extends AppEngPacket
private void writeItem( IAEItemStack slotItem, ByteBuf data ) throws IOException
{
if( slotItem == null )
{
data.writeBoolean( false );
}
else
{
data.writeBoolean( true );
@@ -63,7 +63,9 @@ public class PacketProgressBar extends AppEngPacket
{
Container c = player.openContainer;
if( c instanceof AEBaseContainer )
{
( (AEBaseContainer) c ).updateFullProgressBar( this.id, this.value );
}
}
@Override
@@ -71,6 +73,8 @@ public class PacketProgressBar extends AppEngPacket
{
Container c = player.openContainer;
if( c instanceof AEBaseContainer )
{
( (AEBaseContainer) c ).updateFullProgressBar( this.id, this.value );
}
}
}
@@ -52,7 +52,9 @@ public class PacketSwitchGuis extends AppEngPacket
this.newGui = newGui;
if( Platform.isClient() )
{
AEBaseGui.switchingGuis = true;
}
ByteBuf data = Unpooled.buffer();
@@ -89,12 +89,15 @@ public class PacketTransitionEffect extends AppEngPacket
World world = ClientHelper.proxy.getWorld();
for( int zz = 0; zz < ( this.mode ? 32 : 8 ); zz++ )
{
if( CommonHelper.proxy.shouldAddParticles( Platform.getRandom() ) )
{
EnergyFx fx = new EnergyFx( world, this.x + ( this.mode ? ( Platform.getRandomInt() % 100 ) * 0.01 : ( Platform.getRandomInt() % 100 ) * 0.005 - 0.25 ), this.y + ( this.mode ? ( Platform.getRandomInt() % 100 ) * 0.01 : ( Platform.getRandomInt() % 100 ) * 0.005 - 0.25 ), this.z + ( this.mode ? ( Platform.getRandomInt() % 100 ) * 0.01 : ( Platform.getRandomInt() % 100 ) * 0.005 - 0.25 ), Items.diamond );
if( !this.mode )
{
fx.fromItem( this.d );
}
fx.motionX = -0.1 * this.d.offsetX;
fx.motionY = -0.1 * this.d.offsetY;
@@ -102,6 +105,7 @@ public class PacketTransitionEffect extends AppEngPacket
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
}
if( this.mode )
{
@@ -246,7 +246,9 @@ public class PacketValueConfig extends AppEngPacket
{
GuiScreen gs = Minecraft.getMinecraft().currentScreen;
if( gs instanceof GuiCraftingCPU )
{
( (GuiCraftingCPU) gs ).clearItems();
}
}
else if( c instanceof IConfigurableObject )
{