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
@@ -39,7 +39,9 @@ public class NonNullArrayIterator<E> implements Iterator<E>
public boolean hasNext()
{
while( this.offset < this.g.length && this.g[this.offset] == null )
{
this.offset++;
}
return this.offset != this.g.length;
}
@@ -100,7 +100,9 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
TickRateModulation doBusWork()
{
if( !this.proxy.isActive() )
{
return TickRateModulation.IDLE;
}
this.itemToSend = 1;
this.didSomething = false;
@@ -141,7 +143,9 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
if( ais == null || this.itemToSend <= 0 || this.craftOnly() )
{
if( this.isCraftingEnabled() )
{
this.didSomething = this.cratingTracker.handleCrafting( x, this.itemToSend, ais, d, this.getTile().getWorldObj(), this.proxy.getGrid(), cg, this.mySrc ) || this.didSomething;
}
continue;
}
@@ -153,14 +157,20 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
{
this.pushItemIntoTarget( d, energy, inv, o );
if( this.itemToSend <= 0 )
{
break;
}
}
}
else
{
this.pushItemIntoTarget( d, energy, inv, ais );
}
if( this.itemToSend == before && this.isCraftingEnabled() )
{
this.didSomething = this.cratingTracker.handleCrafting( x, this.itemToSend, ais, d, this.getTile().getWorldObj(), this.proxy.getGrid(), cg, this.mySrc ) || this.didSomething;
}
}
}
}
@@ -234,7 +244,9 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
if( !player.isSneaking() )
{
if( Platform.isClient() )
{
return true;
}
Platform.openGUI( player, this.getHost().getTile(), this.side, GuiBridge.GUI_BUS );
return true;
@@ -302,7 +314,9 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
inv.injectItems( ais, Actionable.MODULATE, this.mySrc );
}
else
{
this.didSomething = true;
}
}
}
}
@@ -328,7 +342,9 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
if( energy.extractAEPower( power, mode, PowerMultiplier.CONFIG ) > power - 0.01 )
{
if( mode == Actionable.MODULATE )
{
return AEItemStack.create( d.addItems( items.getItemStack() ) );
}
return AEItemStack.create( d.simulateAdd( items.getItemStack() ) );
}
}
@@ -113,13 +113,19 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
{
IAEItemStack is = this.Config.getAEStackInSlot( x );
if( is != null )
{
priorityList.add( is );
}
}
if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
{
this.myHandler.setPartitionList( new FuzzyPriorityList( priorityList, (FuzzyMode) this.getConfigManager().getSetting( Settings.FUZZY_MODE ) ) );
}
else
{
this.myHandler.setPartitionList( new PrecisePriorityList( priorityList ) );
}
try
{
@@ -150,7 +156,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
super.onChangeInventory( inv, slot, mc, removedStack, newStack );
if( inv == this.Config )
{
this.updateHandler();
}
}
@Override
@@ -180,7 +188,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
public IInventory getInventoryByName( String name )
{
if( name.equals( "config" ) )
{
return this.Config;
}
return super.getInventoryByName( name );
}
@@ -231,16 +241,24 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
ForgeDirection u = bch.getWorldY();
if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), this.side ) )
{
minX = 0;
}
if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), this.side ) )
{
maxX = 16;
}
if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), this.side ) )
{
minY = 0;
}
if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), this.side ) )
{
maxY = 16;
}
}
bch.addBox( 5, 5, 14, 11, 11, 15 );
@@ -275,16 +293,24 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
TileEntity te = this.getHost().getTile();
if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), this.side ) )
{
minX = 0;
}
if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), this.side ) )
{
maxX = 16;
}
if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), this.side ) )
{
minY = 0;
}
if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), this.side ) )
{
maxY = 16;
}
boolean isActive = ( this.clientFlags & ( this.POWERED_FLAG | this.CHANNEL_FLAG ) ) == ( this.POWERED_FLAG | this.CHANNEL_FLAG );
@@ -328,7 +354,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
if( !player.isSneaking() )
{
if( Platform.isClient() )
{
return true;
}
Platform.openGUI( player, this.getHost().getTile(), this.side, GuiBridge.GUI_FORMATION_PLANE );
return true;
@@ -383,7 +411,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
public IAEItemStack injectItems( IAEItemStack input, Actionable type, BaseActionSource src )
{
if( this.blocked || input == null || input.getStackSize() <= 0 )
{
return input;
}
YesNo placeBlock = (YesNo) this.getConfigManager().getSetting( Settings.PLACE_BLOCK );
@@ -413,9 +443,13 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
Chunk c = w.getChunkFromBlockCoords( x, z );
int sum = 0;
for( List Z : c.entityLists )
{
sum += Z.size();
}
if( sum > 32 )
{
return input;
}
}
maxStorage = is.stackSize;
worked = true;
@@ -426,16 +460,24 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
boolean Worked = false;
if( side.offsetX == 0 && side.offsetZ == 0 )
{
Worked = i.onItemUse( is, player, w, x + side.offsetX, y + side.offsetY, z + side.offsetZ, side.getOpposite().ordinal(), side.offsetX, side.offsetY, side.offsetZ );
}
if( !Worked && side.offsetX == 0 && side.offsetZ == 0 )
{
Worked = i.onItemUse( is, player, w, x - side.offsetX, y - side.offsetY, z - side.offsetZ, side.ordinal(), side.offsetX, side.offsetY, side.offsetZ );
}
if( !Worked && side.offsetY == 0 )
{
Worked = i.onItemUse( is, player, w, x, y - 1, z, ForgeDirection.UP.ordinal(), side.offsetX, side.offsetY, side.offsetZ );
}
if( !Worked )
{
i.onItemUse( is, player, w, x, y, z, side.getOpposite().ordinal(), side.offsetX, side.offsetY, side.offsetZ );
}
maxStorage -= is.stackSize;
}
@@ -446,7 +488,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
}
}
else
{
maxStorage = 1;
}
}
else
{
@@ -454,7 +498,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
Chunk c = w.getChunkFromBlockCoords( x, z );
int sum = 0;
for( List Z : c.entityLists )
{
sum += Z.size();
}
if( sum < AEConfig.instance.formationPlaneEntityLimit )
{
@@ -478,9 +524,13 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
{
result = is.getItem().createEntity( w, ei, is );
if( result != null )
{
ei.setDead();
}
else
{
result = ei;
}
}
if( !w.spawnEntityInWorld( result ) )
@@ -491,7 +541,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
}
}
else
{
worked = false;
}
}
}
@@ -502,7 +554,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
IAEItemStack out = input.copy();
out.decStackSize( maxStorage );
if( out.getStackSize() == 0 )
{
return null;
}
return out;
}
@@ -78,11 +78,15 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
public boolean canInsert( ItemStack stack )
{
if( stack == null || stack.getItem() == null )
{
return false;
}
IAEItemStack out = this.destination.injectItems( this.lastItemChecked = AEApi.instance().storage().createItemStack( stack ), Actionable.SIMULATE, this.source );
if( out == null )
{
return true;
}
return out.getStackSize() != stack.stackSize;
}
@@ -145,7 +149,9 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
if( !player.isSneaking() )
{
if( Platform.isClient() )
{
return true;
}
Platform.openGUI( player, this.getHost().getTile(), this.side, GuiBridge.GUI_BUS );
return true;
@@ -170,7 +176,9 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
TickRateModulation doBusWork()
{
if( !this.proxy.isActive() )
{
return TickRateModulation.IDLE;
}
this.worked = false;
@@ -215,7 +223,9 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
while( this.itemToSend > 0 )
{
if( this.importStuff( myAdaptor, ais, inv, energy, fzMode ) )
{
break;
}
}
}
}
@@ -225,7 +235,9 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
while( this.itemToSend > 0 )
{
if( this.importStuff( myAdaptor, null, inv, energy, fzMode ) )
{
break;
}
}
}
}
@@ -235,7 +247,9 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
}
}
else
{
return TickRateModulation.SLEEP;
}
return this.worked ? TickRateModulation.FASTER : TickRateModulation.SLOWER;
}
@@ -245,13 +259,19 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
int toSend = this.itemToSend;
if( toSend > 64 )
{
toSend = 64;
}
ItemStack newItems;
if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
{
newItems = myAdaptor.removeSimilarItems( toSend, whatToImport == null ? null : whatToImport.getItemStack(), fzMode, this.configDestination( inv ) );
}
else
{
newItems = myAdaptor.removeItems( toSend, whatToImport == null ? null : whatToImport.getItemStack(), this.configDestination( inv ) );
}
if( newItems != null )
{
@@ -259,9 +279,13 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
this.itemToSend -= newItems.stackSize;
if( this.lastItemChecked == null || !this.lastItemChecked.isSameType( newItems ) )
{
this.lastItemChecked = AEApi.instance().storage().createItemStack( newItems );
}
else
{
this.lastItemChecked.setStackSize( newItems.stackSize );
}
IAEItemStack failed = Platform.poweredInsert( energy, this.destination, this.lastItemChecked, this.source );
// destination.injectItems( lastItemChecked, Actionable.MODULATE );
@@ -271,10 +295,14 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
return true;
}
else
{
this.worked = true;
}
}
else
{
return true;
}
return false;
}
@@ -120,9 +120,13 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
{
this.reportingValue = v;
if( this.getConfigManager().getSetting( Settings.LEVEL_TYPE ) == LevelType.ENERGY_LEVEL )
{
this.configureWatchers();
}
else
{
this.updateState();
}
}
@MENetworkEventSubscribe
@@ -211,13 +215,19 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
IAEItemStack myStack = this.config.getAEStackInSlot( 0 );
if( this.myWatcher != null )
{
this.myWatcher.clear();
}
if( this.myEnergyWatcher != null )
{
this.myEnergyWatcher.clear();
}
if( this.myCraftingWatcher != null )
{
this.myCraftingWatcher.clear();
}
try
{
@@ -231,7 +241,9 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
if( this.getInstalledUpgrades( Upgrades.CRAFTING ) > 0 )
{
if( this.myCraftingWatcher != null && myStack != null )
{
this.myCraftingWatcher.add( myStack );
}
return;
}
@@ -239,7 +251,9 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
if( this.getConfigManager().getSetting( Settings.LEVEL_TYPE ) == LevelType.ENERGY_LEVEL )
{
if( this.myEnergyWatcher != null )
{
this.myEnergyWatcher.add( (double) this.reportingValue );
}
try
{
@@ -269,7 +283,9 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
this.proxy.getStorage().getItemInventory().removeListener( this );
if( this.myWatcher != null )
{
this.myWatcher.add( myStack );
}
}
this.updateReportingValue( this.proxy.getStorage().getItemInventory() );
@@ -288,7 +304,9 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
{
this.lastReportedValue = 0;
for( IAEItemStack st : monitor.getStorageList() )
{
this.lastReportedValue += st.getStackSize();
}
}
else if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
{
@@ -296,15 +314,21 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
FuzzyMode fzMode = (FuzzyMode) this.getConfigManager().getSetting( Settings.FUZZY_MODE );
Collection<IAEItemStack> fuzzyList = monitor.getStorageList().findFuzzy( myStack, fzMode );
for( IAEItemStack st : fuzzyList )
{
this.lastReportedValue += st.getStackSize();
}
}
else
{
IAEItemStack r = monitor.getStorageList().findPrecise( myStack );
if( r == null )
{
this.lastReportedValue = 0;
}
else
{
this.lastReportedValue = r.getStackSize();
}
}
this.updateState();
@@ -624,7 +648,9 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
if( !player.isSneaking() )
{
if( Platform.isClient() )
{
return true;
}
Platform.openGUI( player, this.getHost().getTile(), this.side, GuiBridge.GUI_LEVEL_EMITTER );
return true;
@@ -643,7 +669,9 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
public void onChangeInventory( IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack )
{
if( inv == this.config )
{
this.configureWatchers();
}
super.onChangeInventory( inv, slot, mc, removedStack, newStack );
}
@@ -684,7 +712,9 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
public IInventory getInventoryByName( String name )
{
if( name.equals( "config" ) )
{
return this.config;
}
return super.getInventoryByName( name );
}
@@ -710,7 +740,9 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
{
IAEItemStack what = this.config.getAEStackInSlot( 0 );
if( what != null )
{
craftingTracker.setEmitable( what );
}
}
}
}
@@ -76,7 +76,9 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
public IInventory getInventoryByName( String name )
{
if( name.equals( "config" ) )
{
return this.config;
}
return super.getInventoryByName( name );
}
@@ -86,9 +88,13 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
try
{
if( !this.isSleeping() )
{
this.proxy.getTick().wakeDevice( this.proxy.getNode() );
}
else
{
this.proxy.getTick().sleepDevice( this.proxy.getNode() );
}
}
catch( GridAccessException e )
{
@@ -104,7 +110,9 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
int newAdaptorHash = Platform.generateTileHash( target );
if( this.adaptorHash == newAdaptorHash && newAdaptorHash != 0 )
{
return this.adaptor;
}
this.adaptorHash = newAdaptorHash;
this.adaptor = InventoryAdaptor.getAdaptor( target, this.side.getOpposite() );
@@ -132,7 +140,9 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
{
this.lastRedstone = !this.lastRedstone;
if( this.lastRedstone && this.getRSMode() == RedstoneMode.SIGNAL_PULSE )
{
this.doBusWork();
}
}
}
@@ -83,13 +83,17 @@ public abstract class PartUpgradeable extends PartBasicState implements IAEAppEn
case HIGH_SIGNAL:
if( this.host.hasRedstone( this.side ) )
{
return false;
}
break;
case LOW_SIGNAL:
if( !this.host.hasRedstone( this.side ) )
{
return false;
}
break;
@@ -136,8 +140,12 @@ public abstract class PartUpgradeable extends PartBasicState implements IAEAppEn
public void getDrops( List<ItemStack> drops, boolean wrenched )
{
for( ItemStack is : this.upgrades )
{
if( is != null )
{
drops.add( is );
}
}
}
@Override
@@ -150,7 +158,9 @@ public abstract class PartUpgradeable extends PartBasicState implements IAEAppEn
public IInventory getInventoryByName( String name )
{
if( name.equals( "upgrades" ) )
{
return this.upgrades;
}
return null;
}
@@ -67,7 +67,9 @@ public abstract class UpgradeInventory extends AppEngInternalInventory implement
public boolean isItemValidForSlot( int i, ItemStack itemstack )
{
if( itemstack == null )
{
return false;
}
Item it = itemstack.getItem();
if( it instanceof IUpgradeModule )
{
@@ -83,7 +85,9 @@ public abstract class UpgradeInventory extends AppEngInternalInventory implement
public int getInstalledUpgrades( Upgrades u )
{
if( !this.cached )
{
this.updateUpgradeInfo();
}
switch( u )
{
@@ -114,7 +118,9 @@ public abstract class UpgradeInventory extends AppEngInternalInventory implement
for( ItemStack is : this )
{
if( is == null || is.getItem() == null || !( is.getItem() instanceof IUpgradeModule ) )
{
continue;
}
Upgrades myUpgrade = ( (IUpgradeModule) is.getItem() ).getType( is );
switch( myUpgrade )
@@ -168,6 +174,8 @@ public abstract class UpgradeInventory extends AppEngInternalInventory implement
{
this.cached = false;
if( this.parent != null && Platform.isServer() )
{
this.parent.onChangeInventory( inv, slot, mc, removedStack, newStack );
}
}
}