Basic reformat, hit once, hope never again

This commit is contained in:
thatsIch
2015-04-03 08:54:31 +02:00
parent 4ff1631f89
commit d34c988c88
886 changed files with 31400 additions and 30990 deletions
File diff suppressed because it is too large Load Diff
@@ -67,12 +67,6 @@ public class PartCableCovered extends PartCable
this.getHost().markForUpdate();
}
@Override
public IIcon getTexture( AEColor c )
{
return this.getCoveredTexture( c );
}
@Override
public AECableType getCableConnectionType()
{
@@ -84,18 +78,18 @@ public class PartCableCovered extends PartCable
{
bch.addBox( 5.0, 5.0, 5.0, 11.0, 11.0, 11.0 );
if ( Platform.isServer() )
if( Platform.isServer() )
{
IGridNode n = this.getGridNode();
if ( n != null )
if( n != null )
this.connections = n.getConnectedSides();
else
this.connections.clear();
}
for ( ForgeDirection of : this.connections )
for( ForgeDirection of : this.connections )
{
switch ( of )
switch( of )
{
case DOWN:
bch.addBox( 5.0, 0.0, 5.0, 11.0, 5.0, 11.0 );
@@ -132,7 +126,7 @@ public class PartCableCovered extends PartCable
OffsetIcon main = new OffsetIcon( this.getTexture( this.getCableColor() ), offU, offV );
for ( ForgeDirection side : EnumSet.of( ForgeDirection.UP, ForgeDirection.DOWN ) )
for( ForgeDirection side : EnumSet.of( ForgeDirection.UP, ForgeDirection.DOWN ) )
{
rh.renderInventoryFace( main, side, renderer );
}
@@ -141,14 +135,14 @@ public class PartCableCovered extends PartCable
offV = 0;
main = new OffsetIcon( this.getTexture( this.getCableColor() ), offU, offV );
for ( ForgeDirection side : EnumSet.of( ForgeDirection.EAST, ForgeDirection.WEST ) )
for( ForgeDirection side : EnumSet.of( ForgeDirection.EAST, ForgeDirection.WEST ) )
{
rh.renderInventoryFace( main, side, renderer );
}
main = new OffsetIcon( this.getTexture( this.getCableColor() ), 0, 0 );
for ( ForgeDirection side : EnumSet.of( ForgeDirection.SOUTH, ForgeDirection.NORTH ) )
for( ForgeDirection side : EnumSet.of( ForgeDirection.SOUTH, ForgeDirection.NORTH ) )
{
rh.renderInventoryFace( main, side, renderer );
}
@@ -156,6 +150,12 @@ public class PartCableCovered extends PartCable
rh.setTexture( null );
}
@Override
public IIcon getTexture( AEColor c )
{
return this.getCoveredTexture( c );
}
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
@@ -167,21 +167,21 @@ public class PartCableCovered extends PartCable
boolean hasBuses = false;
IPartHost ph = this.getHost();
for ( ForgeDirection of : EnumSet.complementOf( this.connections ) )
for( ForgeDirection of : EnumSet.complementOf( this.connections ) )
{
IPart bp = ph.getPart( of );
if ( bp instanceof IGridHost )
if( bp instanceof IGridHost )
{
if ( of != ForgeDirection.UNKNOWN )
if( of != ForgeDirection.UNKNOWN )
{
sides.add( of );
hasBuses = true;
}
int len = bp.cableConnectionRenderTo();
if ( len < 8 )
if( len < 8 )
{
switch ( of )
switch( of )
{
case DOWN:
rh.setBounds( 6, len, 6, 10, 5, 10 );
@@ -209,9 +209,9 @@ public class PartCableCovered extends PartCable
}
}
if ( sides.size() != 2 || !this.nonLinear( sides ) || hasBuses )
if( sides.size() != 2 || !this.nonLinear( sides ) || hasBuses )
{
for ( ForgeDirection of : this.connections )
for( ForgeDirection of : this.connections )
{
this.renderCoveredConnection( x, y, z, rh, renderer, this.channelsOnSide[of.ordinal()], of );
}
@@ -224,9 +224,9 @@ public class PartCableCovered extends PartCable
{
IIcon def = this.getTexture( this.getCableColor() );
IIcon off = new OffsetIcon( def, 0, -12 );
for ( ForgeDirection of : this.connections )
for( ForgeDirection of : this.connections )
{
switch ( of )
switch( of )
{
case DOWN:
case UP:
@@ -77,79 +77,23 @@ public class PartCableSmart extends PartCable
return AECableType.SMART;
}
@Override
public IIcon getTexture( AEColor c )
{
return this.getSmartTexture( c );
}
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
{
GL11.glTranslated( -0.0, -0.0, 0.3 );
float offU = 0;
float offV = 9;
OffsetIcon main = new OffsetIcon( this.getTexture( this.getCableColor() ), offU, offV );
OffsetIcon ch1 = new OffsetIcon( this.getChannelTex( 4, false ).getIcon(), offU, offV );
OffsetIcon ch2 = new OffsetIcon( this.getChannelTex( 4, true ).getIcon(), offU, offV );
for ( ForgeDirection side : EnumSet.of( ForgeDirection.UP, ForgeDirection.DOWN ) )
{
rh.setBounds( 5.0f, 5.0f, 2.0f, 11.0f, 11.0f, 14.0f );
rh.renderInventoryFace( main, side, renderer );
rh.renderInventoryFace( ch1, side, renderer );
rh.renderInventoryFace( ch2, side, renderer );
}
offU = 9;
offV = 0;
main = new OffsetIcon( this.getTexture( this.getCableColor() ), offU, offV );
ch1 = new OffsetIcon( this.getChannelTex( 4, false ).getIcon(), offU, offV );
ch2 = new OffsetIcon( this.getChannelTex( 4, true ).getIcon(), offU, offV );
for ( ForgeDirection side : EnumSet.of( ForgeDirection.EAST, ForgeDirection.WEST ) )
{
rh.setBounds( 5.0f, 5.0f, 2.0f, 11.0f, 11.0f, 14.0f );
rh.renderInventoryFace( main, side, renderer );
rh.renderInventoryFace( ch1, side, renderer );
rh.renderInventoryFace( ch2, side, renderer );
}
main = new OffsetIcon( this.getTexture( this.getCableColor() ), 0, 0 );
ch1 = new OffsetIcon( this.getChannelTex( 4, false ).getIcon(), 0, 0 );
ch2 = new OffsetIcon( this.getChannelTex( 4, true ).getIcon(), 0, 0 );
for ( ForgeDirection side : EnumSet.of( ForgeDirection.SOUTH, ForgeDirection.NORTH ) )
{
rh.setBounds( 5.0f, 5.0f, 2.0f, 11.0f, 11.0f, 14.0f );
rh.renderInventoryFace( main, side, renderer );
rh.renderInventoryFace( ch1, side, renderer );
rh.renderInventoryFace( ch2, side, renderer );
}
rh.setTexture( null );
}
@Override
public void getBoxes( IPartCollisionHelper bch )
{
bch.addBox( 5.0, 5.0, 5.0, 11.0, 11.0, 11.0 );
if ( Platform.isServer() )
if( Platform.isServer() )
{
IGridNode n = this.getGridNode();
if ( n != null )
if( n != null )
this.connections = n.getConnectedSides();
else
this.connections.clear();
}
for ( ForgeDirection of : this.connections )
for( ForgeDirection of : this.connections )
{
switch ( of )
switch( of )
{
case DOWN:
bch.addBox( 5.0, 0.0, 5.0, 11.0, 5.0, 11.0 );
@@ -174,6 +118,62 @@ public class PartCableSmart extends PartCable
}
}
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
{
GL11.glTranslated( -0.0, -0.0, 0.3 );
float offU = 0;
float offV = 9;
OffsetIcon main = new OffsetIcon( this.getTexture( this.getCableColor() ), offU, offV );
OffsetIcon ch1 = new OffsetIcon( this.getChannelTex( 4, false ).getIcon(), offU, offV );
OffsetIcon ch2 = new OffsetIcon( this.getChannelTex( 4, true ).getIcon(), offU, offV );
for( ForgeDirection side : EnumSet.of( ForgeDirection.UP, ForgeDirection.DOWN ) )
{
rh.setBounds( 5.0f, 5.0f, 2.0f, 11.0f, 11.0f, 14.0f );
rh.renderInventoryFace( main, side, renderer );
rh.renderInventoryFace( ch1, side, renderer );
rh.renderInventoryFace( ch2, side, renderer );
}
offU = 9;
offV = 0;
main = new OffsetIcon( this.getTexture( this.getCableColor() ), offU, offV );
ch1 = new OffsetIcon( this.getChannelTex( 4, false ).getIcon(), offU, offV );
ch2 = new OffsetIcon( this.getChannelTex( 4, true ).getIcon(), offU, offV );
for( ForgeDirection side : EnumSet.of( ForgeDirection.EAST, ForgeDirection.WEST ) )
{
rh.setBounds( 5.0f, 5.0f, 2.0f, 11.0f, 11.0f, 14.0f );
rh.renderInventoryFace( main, side, renderer );
rh.renderInventoryFace( ch1, side, renderer );
rh.renderInventoryFace( ch2, side, renderer );
}
main = new OffsetIcon( this.getTexture( this.getCableColor() ), 0, 0 );
ch1 = new OffsetIcon( this.getChannelTex( 4, false ).getIcon(), 0, 0 );
ch2 = new OffsetIcon( this.getChannelTex( 4, true ).getIcon(), 0, 0 );
for( ForgeDirection side : EnumSet.of( ForgeDirection.SOUTH, ForgeDirection.NORTH ) )
{
rh.setBounds( 5.0f, 5.0f, 2.0f, 11.0f, 11.0f, 14.0f );
rh.renderInventoryFace( main, side, renderer );
rh.renderInventoryFace( ch1, side, renderer );
rh.renderInventoryFace( ch2, side, renderer );
}
rh.setTexture( null );
}
@Override
public IIcon getTexture( AEColor c )
{
return this.getSmartTexture( c );
}
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
@@ -185,21 +185,21 @@ public class PartCableSmart extends PartCable
boolean hasBuses = false;
IPartHost ph = this.getHost();
for ( ForgeDirection of : EnumSet.complementOf( this.connections ) )
for( ForgeDirection of : EnumSet.complementOf( this.connections ) )
{
IPart bp = ph.getPart( of );
if ( bp instanceof IGridHost )
if( bp instanceof IGridHost )
{
if ( of != ForgeDirection.UNKNOWN )
if( of != ForgeDirection.UNKNOWN )
{
sides.add( of );
hasBuses = true;
}
int len = bp.cableConnectionRenderTo();
if ( len < 8 )
if( len < 8 )
{
switch ( of )
switch( of )
{
case DOWN:
rh.setBounds( 6, len, 6, 10, 5, 10 );
@@ -228,7 +228,7 @@ public class PartCableSmart extends PartCable
IIcon firstIcon = new TaughtIcon( this.getChannelTex( this.channelsOnSide[of.ordinal()], false ).getIcon(), -0.2f );
IIcon secondIcon = new TaughtIcon( this.getChannelTex( this.channelsOnSide[of.ordinal()], true ).getIcon(), -0.2f );
if ( of == ForgeDirection.EAST || of == ForgeDirection.WEST )
if( of == ForgeDirection.EAST || of == ForgeDirection.WEST )
{
AEBaseBlock blk = (AEBaseBlock) rh.getBlock();
FlippableIcon ico = blk.getRendererInstance().getTexture( ForgeDirection.EAST );
@@ -251,9 +251,9 @@ public class PartCableSmart extends PartCable
}
}
if ( sides.size() != 2 || !this.nonLinear( sides ) || hasBuses )
if( sides.size() != 2 || !this.nonLinear( sides ) || hasBuses )
{
for ( ForgeDirection of : this.connections )
for( ForgeDirection of : this.connections )
{
this.renderSmartConnection( x, y, z, rh, renderer, this.channelsOnSide[of.ordinal()], of );
}
@@ -266,7 +266,7 @@ public class PartCableSmart extends PartCable
{
ForgeDirection selectedSide = ForgeDirection.UNKNOWN;
for ( ForgeDirection of : this.connections )
for( ForgeDirection of : this.connections )
{
selectedSide = of;
break;
@@ -282,7 +282,7 @@ public class PartCableSmart extends PartCable
IIcon secondTaughtIcon = new TaughtIcon( this.getChannelTex( channels, true ).getIcon(), -0.2f );
IIcon secondOffsetIcon = new OffsetIcon( secondTaughtIcon, 0, -12 );
switch ( selectedSide )
switch( selectedSide )
{
case DOWN:
case UP:
@@ -71,17 +71,6 @@ public class PartDenseCable extends PartCable
return BusSupport.DENSE_CABLE;
}
@Override
public IIcon getTexture( AEColor c )
{
if ( c == AEColor.Transparent )
{
return AEApi.instance().definitions().parts().cableSmart().stack( AEColor.Transparent, 1 ).getIconIndex();
}
return this.getSmartTexture( c );
}
@Override
public AECableType getCableConnectionType()
{
@@ -97,20 +86,20 @@ public class PartDenseCable extends PartCable
bch.addBox( min, min, min, max, max, max );
if ( Platform.isServer() )
if( Platform.isServer() )
{
IGridNode n = this.getGridNode();
if ( n != null )
if( n != null )
this.connections = n.getConnectedSides();
else
this.connections.clear();
}
for ( ForgeDirection of : this.connections )
for( ForgeDirection of : this.connections )
{
if ( this.isDense( of ) )
if( this.isDense( of ) )
{
switch ( of )
switch( of )
{
case DOWN:
bch.addBox( min, 0.0, min, max, min, max );
@@ -135,7 +124,7 @@ public class PartDenseCable extends PartCable
}
else
{
switch ( of )
switch( of )
{
case DOWN:
bch.addBox( 5.0, 0.0, 5.0, 11.0, 5.0, 11.0 );
@@ -175,7 +164,7 @@ public class PartDenseCable extends PartCable
OffsetIcon ch1 = new OffsetIcon( this.getChannelTex( 4, false ).getIcon(), offU, offV );
OffsetIcon ch2 = new OffsetIcon( this.getChannelTex( 4, true ).getIcon(), offU, offV );
for ( ForgeDirection side : EnumSet.of( ForgeDirection.UP, ForgeDirection.DOWN ) )
for( ForgeDirection side : EnumSet.of( ForgeDirection.UP, ForgeDirection.DOWN ) )
{
rh.renderInventoryFace( main, side, renderer );
rh.renderInventoryFace( ch1, side, renderer );
@@ -188,7 +177,7 @@ public class PartDenseCable extends PartCable
ch1 = new OffsetIcon( this.getChannelTex( 4, false ).getIcon(), offU, offV );
ch2 = new OffsetIcon( this.getChannelTex( 4, true ).getIcon(), offU, offV );
for ( ForgeDirection side : EnumSet.of( ForgeDirection.EAST, ForgeDirection.WEST ) )
for( ForgeDirection side : EnumSet.of( ForgeDirection.EAST, ForgeDirection.WEST ) )
{
rh.renderInventoryFace( main, side, renderer );
rh.renderInventoryFace( ch1, side, renderer );
@@ -199,7 +188,7 @@ public class PartDenseCable extends PartCable
ch1 = new OffsetIcon( this.getChannelTex( 4, false ).getIcon(), 0, 0 );
ch2 = new OffsetIcon( this.getChannelTex( 4, true ).getIcon(), 0, 0 );
for ( ForgeDirection side : EnumSet.of( ForgeDirection.SOUTH, ForgeDirection.NORTH ) )
for( ForgeDirection side : EnumSet.of( ForgeDirection.SOUTH, ForgeDirection.NORTH ) )
{
rh.renderInventoryFace( main, side, renderer );
rh.renderInventoryFace( ch1, side, renderer );
@@ -209,6 +198,17 @@ public class PartDenseCable extends PartCable
rh.setTexture( null );
}
@Override
public IIcon getTexture( AEColor c )
{
if( c == AEColor.Transparent )
{
return AEApi.instance().definitions().parts().cableSmart().stack( AEColor.Transparent, 1 ).getIconIndex();
}
return this.getSmartTexture( c );
}
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
@@ -219,19 +219,19 @@ public class PartDenseCable extends PartCable
EnumSet<ForgeDirection> sides = this.connections.clone();
boolean hasBuses = false;
for ( ForgeDirection of : this.connections )
for( ForgeDirection of : this.connections )
{
if ( !this.isDense( of ) )
if( !this.isDense( of ) )
hasBuses = true;
}
if ( sides.size() != 2 || !this.nonLinear( sides ) || hasBuses )
if( sides.size() != 2 || !this.nonLinear( sides ) || hasBuses )
{
for ( ForgeDirection of : this.connections )
for( ForgeDirection of : this.connections )
{
if ( this.isDense( of ) )
if( this.isDense( of ) )
this.renderDenseConnection( x, y, z, rh, renderer, this.channelsOnSide[of.ordinal()], of );
else if ( this.isSmart( of ) )
else if( this.isSmart( of ) )
this.renderSmartConnection( x, y, z, rh, renderer, this.channelsOnSide[of.ordinal()], of );
else
this.renderCoveredConnection( x, y, z, rh, renderer, this.channelsOnSide[of.ordinal()], of );
@@ -245,7 +245,7 @@ public class PartDenseCable extends PartCable
{
ForgeDirection selectedSide = ForgeDirection.UNKNOWN;
for ( ForgeDirection of : this.connections )
for( ForgeDirection of : this.connections )
{
selectedSide = of;
break;
@@ -261,7 +261,7 @@ public class PartDenseCable extends PartCable
IIcon secondIcon = new TaughtIcon( this.getChannelTex( channels, true ).getIcon(), -0.2f );
IIcon secondOffset = new OffsetIcon( secondIcon, 0, -12 );
switch ( selectedSide )
switch( selectedSide )
{
case DOWN:
case UP:
@@ -387,12 +387,12 @@ public class PartDenseCable extends PartCable
*/
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of, of.getOpposite() ) ) );
if ( ghh != null && partHost != null && ghh.getCableConnectionType( of ) != AECableType.GLASS && partHost.getColor() != AEColor.Transparent && partHost.getPart( of.getOpposite() ) == null )
if( ghh != null && partHost != null && ghh.getCableConnectionType( of ) != AECableType.GLASS && partHost.getColor() != AEColor.Transparent && partHost.getPart( of.getOpposite() ) == null )
rh.setTexture( this.getTexture( myColor = partHost.getColor() ) );
else
rh.setTexture( this.getTexture( this.getCableColor() ) );
switch ( of )
switch( of )
{
case DOWN:
rh.setBounds( 4, 0, 4, 12, 5, 12 );
@@ -419,7 +419,7 @@ public class PartDenseCable extends PartCable
rh.renderBlock( x, y, z, renderer );
rh.setFacesToRender( EnumSet.allOf( ForgeDirection.class ) );
if ( !isGlass )
if( !isGlass )
{
this.setSmartConnectionRotations( of, renderer );
@@ -442,7 +442,7 @@ public class PartDenseCable extends PartCable
private boolean isSmart( ForgeDirection of )
{
TileEntity te = this.tile.getWorldObj().getTileEntity( this.tile.xCoord + of.offsetX, this.tile.yCoord + of.offsetY, this.tile.zCoord + of.offsetZ );
if ( te instanceof IGridHost )
if( te instanceof IGridHost )
{
AECableType t = ( (IGridHost) te ).getCableConnectionType( of.getOpposite() );
return t == AECableType.SMART;
@@ -452,7 +452,7 @@ public class PartDenseCable extends PartCable
private IIcon getDenseTexture( AEColor c )
{
switch ( c )
switch( c )
{
case Black:
return CableBusTextures.MEDense_Black.getIcon();
@@ -495,7 +495,7 @@ public class PartDenseCable extends PartCable
private boolean isDense( ForgeDirection of )
{
TileEntity te = this.tile.getWorldObj().getTileEntity( this.tile.xCoord + of.offsetX, this.tile.yCoord + of.offsetY, this.tile.zCoord + of.offsetZ );
if ( te instanceof IGridHost )
if( te instanceof IGridHost )
{
AECableType t = ( (IGridHost) te ).getCableConnectionType( of.getOpposite() );
return t == AECableType.DENSE;
@@ -18,6 +18,7 @@
package appeng.parts.networking;
import java.util.EnumSet;
import java.util.Set;
@@ -47,12 +48,14 @@ import appeng.me.GridAccessException;
import appeng.me.helpers.AENetworkProxy;
import appeng.parts.AEBasePart;
public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
{
final AENetworkProxy outerProxy = new AENetworkProxy( this, "outer", this.proxy.getMachineRepresentation(), true );
public PartQuartzFiber(ItemStack is) {
public PartQuartzFiber( ItemStack is )
{
super( is );
this.proxy.setIdlePowerUsage( 0 );
this.proxy.setFlags( GridFlags.CANNOT_CARRY );
@@ -61,79 +64,20 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
}
@Override
public void onPlacement(EntityPlayer player, ItemStack held, ForgeDirection side)
{
super.onPlacement( player, held, side );
this.outerProxy.setOwner( player );
}
@Override
public void setPartHostInfo(ForgeDirection side, IPartHost host, TileEntity tile)
{
super.setPartHostInfo( side, host, tile );
this.outerProxy.setValidSides( EnumSet.of( side ) );
}
@Override
public void readFromNBT(NBTTagCompound extra)
{
super.readFromNBT( extra );
this.outerProxy.readFromNBT( extra );
}
@Override
public void writeToNBT(NBTTagCompound extra)
{
super.writeToNBT( extra );
this.outerProxy.writeToNBT( extra );
}
@Override
public void addToWorld()
{
super.addToWorld();
this.outerProxy.onReady();
}
@Override
public void removeFromWorld()
{
super.removeFromWorld();
this.outerProxy.invalidate();
}
@Override
public IGridNode getExternalFacingNode()
{
return this.outerProxy.getNode();
}
@Override
public AECableType getCableConnectionType(ForgeDirection dir)
public AECableType getCableConnectionType( ForgeDirection dir )
{
return AECableType.GLASS;
}
@Override
@SideOnly(Side.CLIENT)
public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer)
{
IIcon myIcon = this.is.getIconIndex();
rh.setTexture( myIcon );
rh.setBounds( 6, 6, 10, 10, 10, 16 );
rh.renderBlock( x, y, z, renderer );
rh.setTexture( null );
}
@Override
public void getBoxes(IPartCollisionHelper bch)
public void getBoxes( IPartCollisionHelper bch )
{
bch.addBox( 6, 6, 10, 10, 10, 16 );
}
@Override
@SideOnly(Side.CLIENT)
public void renderInventory(IPartRenderHelper rh, RenderBlocks renderer)
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
{
GL11.glTranslated( -0.2, -0.3, 0.0 );
@@ -144,60 +88,55 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
}
@Override
public double extractAEPower(double amt, Actionable mode, Set<IEnergyGrid> seen)
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
{
double acquiredPower = 0;
try
{
IEnergyGrid eg = this.proxy.getEnergy();
acquiredPower += eg.extractAEPower( amt - acquiredPower, mode, seen );
}
catch (GridAccessException e)
{
// :P
}
try
{
IEnergyGrid eg = this.outerProxy.getEnergy();
acquiredPower += eg.extractAEPower( amt - acquiredPower, mode, seen );
}
catch (GridAccessException e)
{
// :P
}
return acquiredPower;
IIcon myIcon = this.is.getIconIndex();
rh.setTexture( myIcon );
rh.setBounds( 6, 6, 10, 10, 10, 16 );
rh.renderBlock( x, y, z, renderer );
rh.setTexture( null );
}
@Override
public double injectAEPower(double amt, Actionable mode, Set<IEnergyGrid> seen)
public void readFromNBT( NBTTagCompound extra )
{
super.readFromNBT( extra );
this.outerProxy.readFromNBT( extra );
}
try
{
IEnergyGrid eg = this.proxy.getEnergy();
if ( !seen.contains( eg ) )
return eg.injectAEPower( amt, mode, seen );
}
catch (GridAccessException e)
{
// :P
}
@Override
public void writeToNBT( NBTTagCompound extra )
{
super.writeToNBT( extra );
this.outerProxy.writeToNBT( extra );
}
try
{
IEnergyGrid eg = this.outerProxy.getEnergy();
if ( !seen.contains( eg ) )
return eg.injectAEPower( amt, mode, seen );
}
catch (GridAccessException e)
{
// :P
}
@Override
public void removeFromWorld()
{
super.removeFromWorld();
this.outerProxy.invalidate();
}
return amt;
@Override
public void addToWorld()
{
super.addToWorld();
this.outerProxy.onReady();
}
@Override
public void setPartHostInfo( ForgeDirection side, IPartHost host, TileEntity tile )
{
super.setPartHostInfo( side, host, tile );
this.outerProxy.setValidSides( EnumSet.of( side ) );
}
@Override
public IGridNode getExternalFacingNode()
{
return this.outerProxy.getNode();
}
@Override
@@ -207,7 +146,71 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
}
@Override
public double getEnergyDemand(double amt, Set<IEnergyGrid> seen)
public void onPlacement( EntityPlayer player, ItemStack held, ForgeDirection side )
{
super.onPlacement( player, held, side );
this.outerProxy.setOwner( player );
}
@Override
public double extractAEPower( double amt, Actionable mode, Set<IEnergyGrid> seen )
{
double acquiredPower = 0;
try
{
IEnergyGrid eg = this.proxy.getEnergy();
acquiredPower += eg.extractAEPower( amt - acquiredPower, mode, seen );
}
catch( GridAccessException e )
{
// :P
}
try
{
IEnergyGrid eg = this.outerProxy.getEnergy();
acquiredPower += eg.extractAEPower( amt - acquiredPower, mode, seen );
}
catch( GridAccessException e )
{
// :P
}
return acquiredPower;
}
@Override
public double injectAEPower( double amt, Actionable mode, Set<IEnergyGrid> seen )
{
try
{
IEnergyGrid eg = this.proxy.getEnergy();
if( !seen.contains( eg ) )
return eg.injectAEPower( amt, mode, seen );
}
catch( GridAccessException e )
{
// :P
}
try
{
IEnergyGrid eg = this.outerProxy.getEnergy();
if( !seen.contains( eg ) )
return eg.injectAEPower( amt, mode, seen );
}
catch( GridAccessException e )
{
// :P
}
return amt;
}
@Override
public double getEnergyDemand( double amt, Set<IEnergyGrid> seen )
{
double demand = 0;
@@ -216,7 +219,7 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
IEnergyGrid eg = this.proxy.getEnergy();
demand += eg.getEnergyDemand( amt - demand, seen );
}
catch (GridAccessException e)
catch( GridAccessException e )
{
// :P
}
@@ -226,12 +229,11 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
IEnergyGrid eg = this.outerProxy.getEnergy();
demand += eg.getEnergyDemand( amt - demand, seen );
}
catch (GridAccessException e)
catch( GridAccessException e )
{
// :P
}
return demand;
}
}