Basic reformat, hit once, hope never again
This commit is contained in:
@@ -78,9 +78,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
@Override
|
||||
protected ItemStack getItemFromTile( Object obj )
|
||||
{
|
||||
if ( ( (TileCraftingTile) obj ).isAccelerator() )
|
||||
if( ( (TileCraftingTile) obj ).isAccelerator() )
|
||||
{
|
||||
for ( ItemStack accelerator : AEApi.instance().definitions().blocks().craftingAccelerator().maybeStack( 1 ).asSet() )
|
||||
for( ItemStack accelerator : AEApi.instance().definitions().blocks().craftingAccelerator().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
return accelerator;
|
||||
}
|
||||
@@ -100,13 +100,13 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
public void setName( String name )
|
||||
{
|
||||
super.setName( name );
|
||||
if ( this.cluster != null )
|
||||
if( this.cluster != null )
|
||||
this.cluster.updateName();
|
||||
}
|
||||
|
||||
public boolean isAccelerator()
|
||||
{
|
||||
if ( this.worldObj == null )
|
||||
if( this.worldObj == null )
|
||||
return false;
|
||||
return ( this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord ) & 3 ) == 1;
|
||||
}
|
||||
@@ -126,7 +126,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
|
||||
public void updateStatus( CraftingCPUCluster c )
|
||||
{
|
||||
if ( this.cluster != null && this.cluster != c )
|
||||
if( this.cluster != null && this.cluster != c )
|
||||
this.cluster.breakCluster();
|
||||
|
||||
this.cluster = c;
|
||||
@@ -135,24 +135,24 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
|
||||
public void updateMeta( boolean updateFormed )
|
||||
{
|
||||
if ( this.worldObj == null || this.notLoaded() )
|
||||
if( this.worldObj == null || this.notLoaded() )
|
||||
return;
|
||||
|
||||
boolean formed = this.isFormed();
|
||||
boolean power = false;
|
||||
|
||||
if ( this.gridProxy.isReady() )
|
||||
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 )
|
||||
if( current != newMeta )
|
||||
this.worldObj.setBlockMetadataWithNotify( this.xCoord, this.yCoord, this.zCoord, newMeta, 2 );
|
||||
|
||||
if ( updateFormed )
|
||||
if( updateFormed )
|
||||
{
|
||||
if ( formed )
|
||||
if( formed )
|
||||
this.gridProxy.setValidSides( EnumSet.allOf( ForgeDirection.class ) );
|
||||
else
|
||||
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
||||
@@ -161,7 +161,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
|
||||
public boolean isFormed()
|
||||
{
|
||||
if ( Platform.isClient() )
|
||||
if( Platform.isClient() )
|
||||
return ( this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord ) & 8 ) == 8;
|
||||
return this.cluster != null;
|
||||
}
|
||||
@@ -170,7 +170,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
public void writeToNBT_TileCraftingTile( NBTTagCompound data )
|
||||
{
|
||||
data.setBoolean( "core", this.isCoreBlock );
|
||||
if ( this.isCoreBlock && this.cluster != null )
|
||||
if( this.isCoreBlock && this.cluster != null )
|
||||
this.cluster.writeToNBT( data );
|
||||
}
|
||||
|
||||
@@ -178,9 +178,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
public void readFromNBT_TileCraftingTile( NBTTagCompound data )
|
||||
{
|
||||
this.isCoreBlock = data.getBoolean( "core" );
|
||||
if ( this.isCoreBlock )
|
||||
if( this.isCoreBlock )
|
||||
{
|
||||
if ( this.cluster != null )
|
||||
if( this.cluster != null )
|
||||
this.cluster.readFromNBT( data );
|
||||
else
|
||||
this.previousState = (NBTTagCompound) data.copy();
|
||||
@@ -190,10 +190,10 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
@Override
|
||||
public void disconnect( boolean update )
|
||||
{
|
||||
if ( this.cluster != null )
|
||||
if( this.cluster != null )
|
||||
{
|
||||
this.cluster.destroy();
|
||||
if ( update )
|
||||
if( update )
|
||||
this.updateMeta( true );
|
||||
}
|
||||
}
|
||||
@@ -225,12 +225,6 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
public boolean isStatus()
|
||||
{
|
||||
return false;
|
||||
} @Override
|
||||
public boolean isPowered()
|
||||
{
|
||||
if ( Platform.isClient() )
|
||||
return ( this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord ) & 4 ) == 4;
|
||||
return this.gridProxy.isActive();
|
||||
}
|
||||
|
||||
public boolean isStorage()
|
||||
@@ -245,7 +239,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
|
||||
public void breakCluster()
|
||||
{
|
||||
if ( this.cluster != null )
|
||||
if( this.cluster != null )
|
||||
{
|
||||
this.cluster.cancel();
|
||||
IMEInventory<IAEItemStack> inv = this.cluster.getInventory();
|
||||
@@ -253,20 +247,20 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
LinkedList<WorldCoord> places = new LinkedList<WorldCoord>();
|
||||
|
||||
Iterator<IGridHost> i = this.cluster.getTiles();
|
||||
while ( i.hasNext() )
|
||||
while( i.hasNext() )
|
||||
{
|
||||
IGridHost h = i.next();
|
||||
if ( h == this )
|
||||
if( h == this )
|
||||
places.add( new WorldCoord( this ) );
|
||||
else
|
||||
{
|
||||
TileEntity te = (TileEntity) h;
|
||||
|
||||
for ( ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
|
||||
for( ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
|
||||
{
|
||||
WorldCoord wc = new WorldCoord( te );
|
||||
wc.add( d, 1 );
|
||||
if ( this.worldObj.isAirBlock( wc.x, wc.y, wc.z ) )
|
||||
if( this.worldObj.isAirBlock( wc.x, wc.y, wc.z ) )
|
||||
places.add( wc );
|
||||
}
|
||||
}
|
||||
@@ -274,17 +268,17 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
|
||||
Collections.shuffle( places );
|
||||
|
||||
if ( places.isEmpty() )
|
||||
if( places.isEmpty() )
|
||||
throw new RuntimeException( "No air or even the tile hat was destroyed?!?!" );
|
||||
|
||||
for ( IAEItemStack ais : inv.getAvailableItems( AEApi.instance().storage().createItemList() ) )
|
||||
for( IAEItemStack ais : inv.getAvailableItems( AEApi.instance().storage().createItemList() ) )
|
||||
{
|
||||
ais = ais.copy();
|
||||
ais.setStackSize( ais.getItemStack().getMaxStackSize() );
|
||||
while ( true )
|
||||
while( true )
|
||||
{
|
||||
IAEItemStack g = inv.extractItems( ais.copy(), Actionable.MODULATE, this.cluster.getActionSource() );
|
||||
if ( g == null )
|
||||
if( g == null )
|
||||
break;
|
||||
|
||||
WorldCoord wc = places.poll();
|
||||
@@ -298,12 +292,18 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isPowered()
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
return ( this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord ) & 4 ) == 4;
|
||||
return this.gridProxy.isActive();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive()
|
||||
{
|
||||
if ( Platform.isServer() )
|
||||
if( Platform.isServer() )
|
||||
return this.gridProxy.isActive();
|
||||
return this.isPowered() && this.isFormed();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user