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
@@ -59,9 +59,13 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
boolean hasItem = data.readBoolean();
if( hasItem )
{
this.dspPlay = AEItemStack.loadItemStackFromPacket( data );
}
else
{
this.dspPlay = null;
}
this.updateList = true;
return oldPaintedColor != this.paintedColor; // tesr!
@@ -73,7 +77,9 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
data.writeByte( this.paintedColor.ordinal() );
if( this.dspPlay == null )
{
data.writeBoolean( false );
}
else
{
data.writeBoolean( true );
@@ -85,7 +91,9 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
public void readFromNBT_TileCraftingMonitorTile( NBTTagCompound data )
{
if( data.hasKey( "paintedColor" ) )
{
this.paintedColor = AEColor.values()[data.getByte( "paintedColor" )];
}
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
@@ -144,7 +152,9 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
public boolean recolourBlock( ForgeDirection side, AEColor newPaintedColor, EntityPlayer who )
{
if( this.paintedColor == newPaintedColor )
{
return false;
}
this.paintedColor = newPaintedColor;
this.markDirty();
@@ -76,7 +76,9 @@ public class TileCraftingStorageTile extends TileCraftingTile
public int getStorageBytes()
{
if( this.worldObj == null || this.notLoaded() )
{
return 0;
}
switch( this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord ) & 3 )
{
@@ -101,13 +101,17 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
super.setName( name );
if( this.cluster != null )
{
this.cluster.updateName();
}
}
public boolean isAccelerator()
{
if( this.worldObj == null )
{
return false;
}
return ( this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord ) & 3 ) == 1;
}
@@ -127,7 +131,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
public void updateStatus( CraftingCPUCluster c )
{
if( this.cluster != null && this.cluster != c )
{
this.cluster.breakCluster();
}
this.cluster = c;
this.updateMeta( true );
@@ -136,33 +142,45 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
public void updateMeta( boolean updateFormed )
{
if( this.worldObj == null || this.notLoaded() )
{
return;
}
boolean formed = this.isFormed();
boolean power = false;
if( this.gridProxy.isReady() )
{
power = this.gridProxy.isActive();
}
int current = this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord );
int newMeta = ( current & 3 ) | ( formed ? 8 : 0 ) | ( power ? 4 : 0 );
if( current != newMeta )
{
this.worldObj.setBlockMetadataWithNotify( this.xCoord, this.yCoord, this.zCoord, newMeta, 2 );
}
if( updateFormed )
{
if( formed )
{
this.gridProxy.setValidSides( EnumSet.allOf( ForgeDirection.class ) );
}
else
{
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
}
}
}
public boolean isFormed()
{
if( Platform.isClient() )
{
return ( this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord ) & 8 ) == 8;
}
return this.cluster != null;
}
@@ -171,7 +189,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
data.setBoolean( "core", this.isCoreBlock );
if( this.isCoreBlock && this.cluster != null )
{
this.cluster.writeToNBT( data );
}
}
@TileEvent( TileEventType.WORLD_NBT_READ )
@@ -181,9 +201,13 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
if( this.isCoreBlock )
{
if( this.cluster != null )
{
this.cluster.readFromNBT( data );
}
else
{
this.previousState = (NBTTagCompound) data.copy();
}
}
}
@@ -194,7 +218,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
this.cluster.destroy();
if( update )
{
this.updateMeta( true );
}
}
}
@@ -251,7 +277,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
IGridHost h = i.next();
if( h == this )
{
places.add( new WorldCoord( this ) );
}
else
{
TileEntity te = (TileEntity) h;
@@ -261,7 +289,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
WorldCoord wc = new WorldCoord( te );
wc.add( d, 1 );
if( this.worldObj.isAirBlock( wc.x, wc.y, wc.z ) )
{
places.add( wc );
}
}
}
}
@@ -269,7 +299,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
Collections.shuffle( places );
if( places.isEmpty() )
{
throw new IllegalStateException( this.cluster + " does not contain any kind of blocks, which were destroyed." );
}
for( IAEItemStack ais : inv.getAvailableItems( AEApi.instance().storage().createItemList() ) )
{
@@ -279,7 +311,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
IAEItemStack g = inv.extractItems( ais.copy(), Actionable.MODULATE, this.cluster.getActionSource() );
if( g == null )
{
break;
}
WorldCoord wc = places.poll();
places.add( wc );
@@ -296,7 +330,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
public boolean isPowered()
{
if( Platform.isClient() )
{
return ( this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord ) & 4 ) == 4;
}
return this.gridProxy.isActive();
}
@@ -304,7 +340,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
public boolean isActive()
{
if( Platform.isServer() )
{
return this.gridProxy.isActive();
}
return this.isPowered() && this.isFormed();
}
}
@@ -119,7 +119,9 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{
boolean isEmpty = true;
for( int x = 0; x < this.inv.getSizeInventory(); x++ )
{
isEmpty = this.inv.getStackInSlot( x ) == null && isEmpty;
}
if( isEmpty && patternDetails.isCraftable() )
{
@@ -128,7 +130,9 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
this.pushDirection = where;
for( int x = 0; x < table.getSizeInventory(); x++ )
{
this.inv.setInventorySlotContents( x, table.getStackInSlot( x ) );
}
this.updateSleepiness();
this.markDirty();
@@ -147,9 +151,13 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
try
{
if( this.isAwake )
{
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
}
else
{
this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() );
}
}
catch( GridAccessException e )
{
@@ -166,10 +174,14 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
private boolean hasMats()
{
if( this.myPlan == null )
{
return false;
}
for( int x = 0; x < this.craftingInv.getSizeInventory(); x++ )
{
this.craftingInv.setInventorySlotContents( x, this.inv.getStackInSlot( x ) );
}
return this.myPlan.getOutput( this.craftingInv, this.getWorldObj() ) != null;
}
@@ -252,7 +264,9 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
this.reboot = true;
if( this.forcePlan )
{
return;
}
ItemStack is = this.inv.getStackInSlot( 10 );
@@ -306,10 +320,14 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
public IInventory getInventoryByName( String name )
{
if( name.equals( "upgrades" ) )
{
return this.upgrades;
}
if( name.equals( "mac" ) )
{
return this.inv;
}
return null;
}
@@ -336,10 +354,14 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
public boolean isItemValidForSlot( int i, ItemStack itemstack )
{
if( i >= 9 )
{
return false;
}
if( this.hasPattern() )
{
return this.myPlan.isValidItemForSlot( i, itemstack, this.getWorldObj() );
}
return false;
}
@@ -353,7 +375,9 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
public void onChangeInventory( IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added )
{
if( inv == this.inv )
{
this.recalculatePlan();
}
}
@Override
@@ -382,7 +406,9 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{
ItemStack is = this.upgrades.getStackInSlot( h );
if( is != null )
{
drops.add( is );
}
}
}
@@ -403,7 +429,9 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
// did it eject?
if( this.inv.getStackInSlot( 9 ) == null )
{
this.markDirty();
}
this.ejectHeldItems();
this.updateSleepiness();
@@ -418,10 +446,14 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
}
if( this.reboot )
{
TicksSinceLastCall = 1;
}
if( !this.isAwake )
{
return TickRateModulation.SLEEP;
}
this.reboot = false;
int speed = 10;
@@ -450,7 +482,9 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
if( this.progress >= 100 )
{
for( int x = 0; x < this.craftingInv.getSizeInventory(); x++ )
{
this.craftingInv.setInventorySlotContents( x, this.inv.getStackInSlot( x ) );
}
this.progress = 0;
ItemStack output = this.myPlan.getOutput( this.craftingInv, this.getWorldObj() );
@@ -461,7 +495,9 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
this.pushOut( output.copy() );
for( int x = 0; x < this.craftingInv.getSizeInventory(); x++ )
{
this.inv.setInventorySlotContents( x, Platform.getContainerItem( this.craftingInv.getStackInSlot( x ) ) );
}
if( this.inv.getStackInSlot( 10 ) == null )
{
@@ -530,10 +566,14 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
if( this.pushDirection == ForgeDirection.UNKNOWN )
{
for( ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
{
output = this.pushTo( output, d );
}
}
else
{
output = this.pushTo( output, this.pushDirection );
}
if( output == null && this.forcePlan )
{
@@ -547,24 +587,32 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
private ItemStack pushTo( ItemStack output, ForgeDirection d )
{
if( output == null )
{
return output;
}
TileEntity te = this.getWorldObj().getTileEntity( this.xCoord + d.offsetX, this.yCoord + d.offsetY, this.zCoord + d.offsetZ );
if( te == null )
{
return output;
}
InventoryAdaptor adaptor = InventoryAdaptor.getAdaptor( te, d.getOpposite() );
if( adaptor == null )
{
return output;
}
int size = output.stackSize;
output = adaptor.addItems( output );
int newSize = output == null ? 0 : output.stackSize;
if( size != newSize )
{
this.markDirty();
}
return output;
}