Basic reformat, hit once, hope never again
This commit is contained in:
@@ -56,12 +56,6 @@ public class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implements IEn
|
||||
super( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTunnelNetworkChange()
|
||||
{
|
||||
this.getHost().notifyNeighbors();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public IIcon getTypeTexture()
|
||||
@@ -69,6 +63,12 @@ public class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implements IEn
|
||||
return Blocks.iron_block.getBlockTextureFromSide( 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTunnelNetworkChange()
|
||||
{
|
||||
this.getHost().notifyNeighbors();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChanged()
|
||||
{
|
||||
@@ -80,15 +80,15 @@ public class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implements IEn
|
||||
@Override
|
||||
public int receiveEnergy( ForgeDirection from, int maxReceive, boolean simulate )
|
||||
{
|
||||
if ( this.output )
|
||||
if( this.output )
|
||||
return 0;
|
||||
|
||||
if ( this.isActive() )
|
||||
if( this.isActive() )
|
||||
{
|
||||
Stack<PartP2PRFPower> stack = this.getDepth();
|
||||
|
||||
for ( PartP2PRFPower t : stack )
|
||||
if ( t == this )
|
||||
for( PartP2PRFPower t : stack )
|
||||
if( t == this )
|
||||
return 0;
|
||||
|
||||
stack.push( this );
|
||||
@@ -97,39 +97,39 @@ public class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implements IEn
|
||||
|
||||
try
|
||||
{
|
||||
for ( PartP2PRFPower t : this.getOutputs() )
|
||||
for( PartP2PRFPower t : this.getOutputs() )
|
||||
{
|
||||
if ( Platform.getRandomInt() % 2 > 0 )
|
||||
if( Platform.getRandomInt() % 2 > 0 )
|
||||
{
|
||||
int receiver = t.getOutput().receiveEnergy( t.side.getOpposite(), maxReceive, simulate );
|
||||
maxReceive -= receiver;
|
||||
total += receiver;
|
||||
|
||||
if ( maxReceive <= 0 )
|
||||
if( maxReceive <= 0 )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( maxReceive > 0 )
|
||||
if( maxReceive > 0 )
|
||||
{
|
||||
for ( PartP2PRFPower t : this.getOutputs() )
|
||||
for( PartP2PRFPower t : this.getOutputs() )
|
||||
{
|
||||
int receiver = t.getOutput().receiveEnergy( t.side.getOpposite(), maxReceive, simulate );
|
||||
maxReceive -= receiver;
|
||||
total += receiver;
|
||||
|
||||
if ( maxReceive <= 0 )
|
||||
if( maxReceive <= 0 )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.QueueTunnelDrain( PowerUnits.RF, total );
|
||||
}
|
||||
catch ( GridAccessException ignored )
|
||||
catch( GridAccessException ignored )
|
||||
{
|
||||
}
|
||||
|
||||
if ( stack.pop() != this )
|
||||
if( stack.pop() != this )
|
||||
throw new RuntimeException( "Invalid Recursion detected." );
|
||||
|
||||
return total;
|
||||
@@ -142,7 +142,7 @@ public class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implements IEn
|
||||
{
|
||||
Stack<PartP2PRFPower> s = THREAD_STACK.get();
|
||||
|
||||
if ( s == null )
|
||||
if( s == null )
|
||||
THREAD_STACK.set( s = new Stack<PartP2PRFPower>() );
|
||||
|
||||
return s;
|
||||
@@ -150,17 +150,17 @@ public class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implements IEn
|
||||
|
||||
private IEnergyReceiver getOutput()
|
||||
{
|
||||
if ( this.output )
|
||||
if( this.output )
|
||||
{
|
||||
if ( !this.cachedTarget )
|
||||
if( !this.cachedTarget )
|
||||
{
|
||||
TileEntity self = this.getTile();
|
||||
TileEntity te = self.getWorldObj().getTileEntity( self.xCoord + this.side.offsetX, self.yCoord + this.side.offsetY, self.zCoord + this.side.offsetZ );
|
||||
this.outputTarget = te instanceof IEnergyReceiver ? ( IEnergyReceiver ) te : null;
|
||||
this.outputTarget = te instanceof IEnergyReceiver ? (IEnergyReceiver) te : null;
|
||||
this.cachedTarget = true;
|
||||
}
|
||||
|
||||
if ( this.outputTarget == null || !this.outputTarget.canConnectEnergy( this.side.getOpposite() ) )
|
||||
if( this.outputTarget == null || !this.outputTarget.canConnectEnergy( this.side.getOpposite() ) )
|
||||
return NULL_HANDLER;
|
||||
|
||||
return this.outputTarget;
|
||||
@@ -171,32 +171,32 @@ public class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implements IEn
|
||||
@Override
|
||||
public int getEnergyStored( ForgeDirection from )
|
||||
{
|
||||
if ( this.output || !this.isActive() )
|
||||
if( this.output || !this.isActive() )
|
||||
return 0;
|
||||
|
||||
int total = 0;
|
||||
|
||||
Stack<PartP2PRFPower> stack = this.getDepth();
|
||||
|
||||
for ( PartP2PRFPower t : stack )
|
||||
if ( t == this )
|
||||
for( PartP2PRFPower t : stack )
|
||||
if( t == this )
|
||||
return 0;
|
||||
|
||||
stack.push( this );
|
||||
|
||||
try
|
||||
{
|
||||
for ( PartP2PRFPower t : this.getOutputs() )
|
||||
for( PartP2PRFPower t : this.getOutputs() )
|
||||
{
|
||||
total += t.getOutput().getEnergyStored( t.side.getOpposite() );
|
||||
}
|
||||
}
|
||||
catch ( GridAccessException e )
|
||||
catch( GridAccessException e )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( stack.pop() != this )
|
||||
if( stack.pop() != this )
|
||||
throw new RuntimeException( "Invalid Recursion detected." );
|
||||
|
||||
return total;
|
||||
@@ -205,32 +205,32 @@ public class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implements IEn
|
||||
@Override
|
||||
public int getMaxEnergyStored( ForgeDirection from )
|
||||
{
|
||||
if ( this.output || !this.isActive() )
|
||||
if( this.output || !this.isActive() )
|
||||
return 0;
|
||||
|
||||
int total = 0;
|
||||
|
||||
Stack<PartP2PRFPower> stack = this.getDepth();
|
||||
|
||||
for ( PartP2PRFPower t : stack )
|
||||
if ( t == this )
|
||||
for( PartP2PRFPower t : stack )
|
||||
if( t == this )
|
||||
return 0;
|
||||
|
||||
stack.push( this );
|
||||
|
||||
try
|
||||
{
|
||||
for ( PartP2PRFPower t : this.getOutputs() )
|
||||
for( PartP2PRFPower t : this.getOutputs() )
|
||||
{
|
||||
total += t.getOutput().getMaxEnergyStored( t.side.getOpposite() );
|
||||
}
|
||||
}
|
||||
catch ( GridAccessException e )
|
||||
catch( GridAccessException e )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( stack.pop() != this )
|
||||
if( stack.pop() != this )
|
||||
throw new RuntimeException( "Invalid Recursion detected." );
|
||||
|
||||
return total;
|
||||
|
||||
Reference in New Issue
Block a user