Changed access to use this qualifier
This commit is contained in:
@@ -78,9 +78,9 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
|
||||
|
||||
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.MJ5 ) )
|
||||
{
|
||||
pp = (BaseMJPerdition) ((IMJ5) AppEng.instance.getIntegration( IntegrationType.MJ5 )).createPerdition( this );
|
||||
if ( pp != null )
|
||||
pp.configure( 1, 380, 1.0f / 5.0f, 1000 );
|
||||
this.pp = (BaseMJPerdition) ((IMJ5) AppEng.instance.getIntegration( IntegrationType.MJ5 )).createPerdition( this );
|
||||
if ( this.pp != null )
|
||||
this.pp.configure( 1, 380, 1.0f / 5.0f, 1000 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,14 +95,14 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
|
||||
@Method(iname = "MJ5")
|
||||
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
|
||||
{
|
||||
if ( !output && proxy.isActive() )
|
||||
if ( !this.output && this.proxy.isActive() )
|
||||
{
|
||||
float totalRequiredPower = 0.0f;
|
||||
TunnelCollection<PartP2PBCPower> tunnels;
|
||||
|
||||
try
|
||||
{
|
||||
tunnels = getOutputs();
|
||||
tunnels = this.getOutputs();
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
@@ -114,7 +114,7 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
|
||||
IPowerReceptor target = o.getPowerTarget();
|
||||
if ( target != null )
|
||||
{
|
||||
PowerReceiver tp = target.getPowerReceiver( side.getOpposite() );
|
||||
PowerReceiver tp = target.getPowerReceiver( this.side.getOpposite() );
|
||||
if ( tp != null )
|
||||
{
|
||||
double request = tp.powerRequest();
|
||||
@@ -133,7 +133,7 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
|
||||
if ( totalRequiredPower < 0.1 )
|
||||
return TickRateModulation.SLOWER;
|
||||
|
||||
double currentTotal = pp.getPowerReceiver().getEnergyStored();
|
||||
double currentTotal = this.pp.getPowerReceiver().getEnergyStored();
|
||||
if ( currentTotal < 0.01 )
|
||||
return TickRateModulation.SLOWER;
|
||||
|
||||
@@ -142,7 +142,7 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
|
||||
IPowerReceptor target = o.getPowerTarget();
|
||||
if ( target != null )
|
||||
{
|
||||
PowerReceiver tp = target.getPowerReceiver( side.getOpposite() );
|
||||
PowerReceiver tp = target.getPowerReceiver( this.side.getOpposite() );
|
||||
if ( tp != null )
|
||||
{
|
||||
double request = tp.powerRequest();
|
||||
@@ -153,8 +153,8 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
|
||||
if ( request > 0.01 && request > tp.getMinEnergyReceived() )
|
||||
{
|
||||
double toPull = currentTotal * (request / totalRequiredPower);
|
||||
double pulled = pp.useEnergy( 0, toPull, true );
|
||||
QueueTunnelDrain( PowerUnits.MJ, pulled );
|
||||
double pulled = this.pp.useEnergy( 0, toPull, true );
|
||||
this.QueueTunnelDrain( PowerUnits.MJ, pulled );
|
||||
|
||||
tp.receiveEnergy( Type.PIPE, pulled, o.side.getOpposite() );
|
||||
}
|
||||
@@ -176,14 +176,14 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
|
||||
@Method(iname = "MJ6")
|
||||
private IBatteryObject getTargetBattery()
|
||||
{
|
||||
TileEntity te = getWorld().getTileEntity( tile.xCoord + side.offsetX, tile.yCoord + side.offsetY, tile.zCoord + side.offsetZ );
|
||||
TileEntity te = this.getWorld().getTileEntity( this.tile.xCoord + this.side.offsetX, this.tile.yCoord + this.side.offsetY, this.tile.zCoord + this.side.offsetZ );
|
||||
if ( te != null )
|
||||
{
|
||||
IBatteryObject bo = MjAPI.getMjBattery( te, MjAPI.DEFAULT_POWER_FRAMEWORK, side.getOpposite() );
|
||||
IBatteryObject bo = MjAPI.getMjBattery( te, MjAPI.DEFAULT_POWER_FRAMEWORK, this.side.getOpposite() );
|
||||
if ( bo != null )
|
||||
return bo;
|
||||
|
||||
return ((IMJ6) AppEng.instance.getIntegration( IntegrationType.MJ6 )).provider( te, side.getOpposite() );
|
||||
return ((IMJ6) AppEng.instance.getIntegration( IntegrationType.MJ6 )).provider( te, this.side.getOpposite() );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -191,7 +191,7 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
|
||||
@Method(iname = "MJ5")
|
||||
private IPowerReceptor getPowerTarget()
|
||||
{
|
||||
TileEntity te = getWorld().getTileEntity( tile.xCoord + side.offsetX, tile.yCoord + side.offsetY, tile.zCoord + side.offsetZ );
|
||||
TileEntity te = this.getWorld().getTileEntity( this.tile.xCoord + this.side.offsetX, this.tile.yCoord + this.side.offsetY, this.tile.zCoord + this.side.offsetZ );
|
||||
if ( te != null )
|
||||
{
|
||||
if ( te instanceof IPowerReceptor )
|
||||
@@ -204,16 +204,16 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT( tag );
|
||||
if ( pp != null )
|
||||
pp.writeToNBT( tag );
|
||||
if ( this.pp != null )
|
||||
this.pp.writeToNBT( tag );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readFromNBT( tag );
|
||||
if ( pp != null )
|
||||
pp.readFromNBT( tag );
|
||||
if ( this.pp != null )
|
||||
this.pp.readFromNBT( tag );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -227,7 +227,7 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
|
||||
@Method(iname = "MJ5")
|
||||
public PowerReceiver getPowerReceiver(ForgeDirection side)
|
||||
{
|
||||
return pp.getPowerReceiver();
|
||||
return this.pp.getPowerReceiver();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -240,7 +240,7 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
|
||||
@Override
|
||||
public World getWorld()
|
||||
{
|
||||
return tile.getWorldObj();
|
||||
return this.tile.getWorldObj();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -258,7 +258,7 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
|
||||
{
|
||||
double totalRequiredPower = 0.0f;
|
||||
|
||||
for (PartP2PBCPower g : getOutputs())
|
||||
for (PartP2PBCPower g : this.getOutputs())
|
||||
{
|
||||
IBatteryObject o = g.getTargetBattery();
|
||||
if ( o != null )
|
||||
@@ -277,27 +277,27 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
|
||||
@Method(iname = "MJ6")
|
||||
public double addEnergy(double mj)
|
||||
{
|
||||
return addEnergyInternal( mj, false, false );
|
||||
return this.addEnergyInternal( mj, false, false );
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(iname = "MJ6")
|
||||
public double addEnergy(double mj, boolean ignoreCycleLimit)
|
||||
{
|
||||
return addEnergyInternal( mj, true, ignoreCycleLimit );
|
||||
return this.addEnergyInternal( mj, true, ignoreCycleLimit );
|
||||
}
|
||||
|
||||
@Method(iname = "MJ6")
|
||||
private double addEnergyInternal(double mj, boolean cycleLimitMode, boolean ignoreCycleLimit)
|
||||
{
|
||||
if ( output || !proxy.isActive() )
|
||||
if ( this.output || !this.proxy.isActive() )
|
||||
return 0;
|
||||
|
||||
double originalInput = mj;
|
||||
|
||||
try
|
||||
{
|
||||
TunnelCollection<PartP2PBCPower> outs = getOutputs();
|
||||
TunnelCollection<PartP2PBCPower> outs = this.getOutputs();
|
||||
|
||||
double outputs = 0;
|
||||
for (PartP2PBCPower g : outs)
|
||||
@@ -357,7 +357,7 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
|
||||
{
|
||||
double totalRequiredPower = 0.0f;
|
||||
|
||||
for (PartP2PBCPower g : getOutputs())
|
||||
for (PartP2PBCPower g : this.getOutputs())
|
||||
{
|
||||
IBatteryObject o = g.getTargetBattery();
|
||||
if ( o != null )
|
||||
@@ -386,7 +386,7 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
|
||||
{
|
||||
double totalRequiredPower = 0.0f;
|
||||
|
||||
for (PartP2PBCPower g : getOutputs())
|
||||
for (PartP2PBCPower g : this.getOutputs())
|
||||
{
|
||||
IBatteryObject o = g.getTargetBattery();
|
||||
if ( o != null )
|
||||
@@ -409,7 +409,7 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
|
||||
{
|
||||
double totalRequiredPower = 1000000000000.0;
|
||||
|
||||
for (PartP2PBCPower g : getOutputs())
|
||||
for (PartP2PBCPower g : this.getOutputs())
|
||||
{
|
||||
IBatteryObject o = g.getTargetBattery();
|
||||
if ( o != null )
|
||||
@@ -432,7 +432,7 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
|
||||
{
|
||||
double totalRequiredPower = 1000000.0;
|
||||
|
||||
for (PartP2PBCPower g : getOutputs())
|
||||
for (PartP2PBCPower g : this.getOutputs())
|
||||
{
|
||||
IBatteryObject o = g.getTargetBattery();
|
||||
if ( o != null )
|
||||
|
||||
@@ -68,20 +68,20 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT( tag );
|
||||
tag.setDouble( "OutputPacket", OutputEnergyA );
|
||||
tag.setDouble( "OutputPacket2", OutputEnergyB );
|
||||
tag.setDouble( "OutputVoltageA", OutputVoltageA );
|
||||
tag.setDouble( "OutputVoltageB", OutputVoltageB );
|
||||
tag.setDouble( "OutputPacket", this.OutputEnergyA );
|
||||
tag.setDouble( "OutputPacket2", this.OutputEnergyB );
|
||||
tag.setDouble( "OutputVoltageA", this.OutputVoltageA );
|
||||
tag.setDouble( "OutputVoltageB", this.OutputVoltageB );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readFromNBT( tag );
|
||||
OutputEnergyA = tag.getDouble( "OutputPacket" );
|
||||
OutputEnergyB = tag.getDouble( "OutputPacket2" );
|
||||
OutputVoltageA = tag.getDouble( "OutputVoltageA" );
|
||||
OutputVoltageB = tag.getDouble( "OutputVoltageB" );
|
||||
this.OutputEnergyA = tag.getDouble( "OutputPacket" );
|
||||
this.OutputEnergyB = tag.getDouble( "OutputPacket2" );
|
||||
this.OutputVoltageA = tag.getDouble( "OutputVoltageA" );
|
||||
this.OutputVoltageB = tag.getDouble( "OutputVoltageB" );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -94,28 +94,28 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
|
||||
@Override
|
||||
public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction)
|
||||
{
|
||||
if ( !output )
|
||||
return direction.equals( side );
|
||||
if ( !this.output )
|
||||
return direction.equals( this.side );
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean emitsEnergyTo(TileEntity receiver, ForgeDirection direction)
|
||||
{
|
||||
if ( output )
|
||||
return direction.equals( side );
|
||||
if ( this.output )
|
||||
return direction.equals( this.side );
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDemandedEnergy()
|
||||
{
|
||||
if ( output )
|
||||
if ( this.output )
|
||||
return 0;
|
||||
|
||||
try
|
||||
{
|
||||
for (PartP2PIC2Power t : getOutputs())
|
||||
for (PartP2PIC2Power t : this.getOutputs())
|
||||
{
|
||||
if ( t.OutputEnergyA <= 0.0001 || t.OutputEnergyB <= 0.0001 )
|
||||
{
|
||||
@@ -134,13 +134,13 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
|
||||
@Override
|
||||
public void onTunnelNetworkChange()
|
||||
{
|
||||
getHost().notifyNeighbors();
|
||||
this.getHost().notifyNeighbors();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTunnelConfigChange()
|
||||
{
|
||||
getHost().partChanged();
|
||||
this.getHost().partChanged();
|
||||
}
|
||||
|
||||
public float getPowerDrainPerTick()
|
||||
@@ -154,7 +154,7 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
|
||||
TunnelCollection<PartP2PIC2Power> outs;
|
||||
try
|
||||
{
|
||||
outs = getOutputs();
|
||||
outs = this.getOutputs();
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
@@ -191,7 +191,7 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
|
||||
|
||||
if ( x != null && x.OutputEnergyA <= 0.001 )
|
||||
{
|
||||
QueueTunnelDrain( PowerUnits.EU, amount );
|
||||
this.QueueTunnelDrain( PowerUnits.EU, amount );
|
||||
x.OutputEnergyA = amount;
|
||||
x.OutputVoltageA = voltage;
|
||||
return 0;
|
||||
@@ -199,7 +199,7 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
|
||||
|
||||
if ( x != null && x.OutputEnergyB <= 0.001 )
|
||||
{
|
||||
QueueTunnelDrain( PowerUnits.EU, amount );
|
||||
this.QueueTunnelDrain( PowerUnits.EU, amount );
|
||||
x.OutputEnergyB = amount;
|
||||
x.OutputVoltageB = voltage;
|
||||
return 0;
|
||||
@@ -217,30 +217,30 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
|
||||
@Override
|
||||
public double getOfferedEnergy()
|
||||
{
|
||||
if ( output )
|
||||
return OutputEnergyA;
|
||||
if ( this.output )
|
||||
return this.OutputEnergyA;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawEnergy(double amount)
|
||||
{
|
||||
OutputEnergyA -= amount;
|
||||
if ( OutputEnergyA < 0.001 )
|
||||
this.OutputEnergyA -= amount;
|
||||
if ( this.OutputEnergyA < 0.001 )
|
||||
{
|
||||
OutputEnergyA = OutputEnergyB;
|
||||
OutputEnergyB = 0;
|
||||
this.OutputEnergyA = this.OutputEnergyB;
|
||||
this.OutputEnergyB = 0;
|
||||
|
||||
OutputVoltageA = OutputVoltageB;
|
||||
OutputVoltageB = 0;
|
||||
this.OutputVoltageA = this.OutputVoltageB;
|
||||
this.OutputVoltageB = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSourceTier()
|
||||
{
|
||||
if ( output )
|
||||
return calculateTierFromVoltage( OutputVoltageA );
|
||||
if ( this.output )
|
||||
return this.calculateTierFromVoltage( this.OutputVoltageA );
|
||||
return 4;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,25 +81,25 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
{
|
||||
IInventory output = null;
|
||||
|
||||
if ( proxy.isActive() )
|
||||
if ( this.proxy.isActive() )
|
||||
{
|
||||
TileEntity te = tile.getWorldObj().getTileEntity( tile.xCoord + side.offsetX, tile.yCoord + side.offsetY, tile.zCoord + side.offsetZ );
|
||||
TileEntity te = this.tile.getWorldObj().getTileEntity( this.tile.xCoord + this.side.offsetX, this.tile.yCoord + this.side.offsetY, this.tile.zCoord + this.side.offsetZ );
|
||||
|
||||
if ( which.contains( this ) )
|
||||
if ( this.which.contains( this ) )
|
||||
return null;
|
||||
|
||||
which.add( this );
|
||||
this.which.add( this );
|
||||
|
||||
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.BC ) )
|
||||
{
|
||||
IBC buildcraft = (IBC) AppEng.instance.getIntegration( IntegrationType.BC );
|
||||
if ( buildcraft != null )
|
||||
{
|
||||
if ( buildcraft.isPipe( te, side.getOpposite() ) )
|
||||
if ( buildcraft.isPipe( te, this.side.getOpposite() ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
output = new WrapperBCPipe( te, side.getOpposite() );
|
||||
output = new WrapperBCPipe( te, this.side.getOpposite() );
|
||||
}
|
||||
catch (Throwable ignore)
|
||||
{
|
||||
@@ -122,7 +122,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
}
|
||||
else if ( te instanceof ISidedInventory )
|
||||
{
|
||||
output = new WrapperMCISidedInventory( (ISidedInventory) te, side.getOpposite() );
|
||||
output = new WrapperMCISidedInventory( (ISidedInventory) te, this.side.getOpposite() );
|
||||
}
|
||||
else if ( te instanceof IInventory )
|
||||
{
|
||||
@@ -130,7 +130,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
}
|
||||
}
|
||||
|
||||
which.pop();
|
||||
this.which.pop();
|
||||
}
|
||||
|
||||
return output;
|
||||
@@ -139,9 +139,9 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
@Override
|
||||
public void onNeighborChanged()
|
||||
{
|
||||
cachedInv = null;
|
||||
PartP2PItems input = getInput();
|
||||
if ( input != null && output )
|
||||
this.cachedInv = null;
|
||||
PartP2PItems input = this.getInput();
|
||||
if ( input != null && this.output )
|
||||
input.onTunnelNetworkChange();
|
||||
}
|
||||
|
||||
@@ -154,28 +154,28 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
@Override
|
||||
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
|
||||
{
|
||||
boolean wasReq = requested;
|
||||
boolean wasReq = this.requested;
|
||||
|
||||
if ( requested && cachedInv != null )
|
||||
((WrapperChainedInventory) cachedInv).cycleOrder();
|
||||
if ( this.requested && this.cachedInv != null )
|
||||
((WrapperChainedInventory) this.cachedInv).cycleOrder();
|
||||
|
||||
requested = false;
|
||||
this.requested = false;
|
||||
return wasReq ? TickRateModulation.FASTER : TickRateModulation.SLOWER;
|
||||
}
|
||||
|
||||
IInventory getDestination()
|
||||
{
|
||||
requested = true;
|
||||
this.requested = true;
|
||||
|
||||
if ( cachedInv != null )
|
||||
return cachedInv;
|
||||
if ( this.cachedInv != null )
|
||||
return this.cachedInv;
|
||||
|
||||
List<IInventory> outs = new LinkedList<IInventory>();
|
||||
TunnelCollection<PartP2PItems> itemTunnels;
|
||||
|
||||
try
|
||||
{
|
||||
itemTunnels = getOutputs();
|
||||
itemTunnels = this.getOutputs();
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
@@ -194,20 +194,20 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
}
|
||||
}
|
||||
|
||||
return cachedInv = new WrapperChainedInventory( outs );
|
||||
return this.cachedInv = new WrapperChainedInventory( outs );
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void changeStateA(MENetworkBootingStatusChange bs)
|
||||
{
|
||||
if ( !output )
|
||||
if ( !this.output )
|
||||
{
|
||||
cachedInv = null;
|
||||
int olderSize = oldSize;
|
||||
oldSize = getDestination().getSizeInventory();
|
||||
if ( olderSize != oldSize )
|
||||
this.cachedInv = null;
|
||||
int olderSize = this.oldSize;
|
||||
this.oldSize = this.getDestination().getSizeInventory();
|
||||
if ( olderSize != this.oldSize )
|
||||
{
|
||||
getHost().notifyNeighbors();
|
||||
this.getHost().notifyNeighbors();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -215,14 +215,14 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
@MENetworkEventSubscribe
|
||||
public void changeStateB(MENetworkChannelsChanged bs)
|
||||
{
|
||||
if ( !output )
|
||||
if ( !this.output )
|
||||
{
|
||||
cachedInv = null;
|
||||
int olderSize = oldSize;
|
||||
oldSize = getDestination().getSizeInventory();
|
||||
if ( olderSize != oldSize )
|
||||
this.cachedInv = null;
|
||||
int olderSize = this.oldSize;
|
||||
this.oldSize = this.getDestination().getSizeInventory();
|
||||
if ( olderSize != this.oldSize )
|
||||
{
|
||||
getHost().notifyNeighbors();
|
||||
this.getHost().notifyNeighbors();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -230,14 +230,14 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
@MENetworkEventSubscribe
|
||||
public void changeStateC(MENetworkPowerStatusChange bs)
|
||||
{
|
||||
if ( !output )
|
||||
if ( !this.output )
|
||||
{
|
||||
cachedInv = null;
|
||||
int olderSize = oldSize;
|
||||
oldSize = getDestination().getSizeInventory();
|
||||
if ( olderSize != oldSize )
|
||||
this.cachedInv = null;
|
||||
int olderSize = this.oldSize;
|
||||
this.oldSize = this.getDestination().getSizeInventory();
|
||||
if ( olderSize != this.oldSize )
|
||||
{
|
||||
getHost().notifyNeighbors();
|
||||
this.getHost().notifyNeighbors();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -245,19 +245,19 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
@Override
|
||||
public void onTunnelNetworkChange()
|
||||
{
|
||||
if ( !output )
|
||||
if ( !this.output )
|
||||
{
|
||||
cachedInv = null;
|
||||
int olderSize = oldSize;
|
||||
oldSize = getDestination().getSizeInventory();
|
||||
if ( olderSize != oldSize )
|
||||
this.cachedInv = null;
|
||||
int olderSize = this.oldSize;
|
||||
this.oldSize = this.getDestination().getSizeInventory();
|
||||
if ( olderSize != this.oldSize )
|
||||
{
|
||||
getHost().notifyNeighbors();
|
||||
this.getHost().notifyNeighbors();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PartP2PItems input = getInput();
|
||||
PartP2PItems input = this.getInput();
|
||||
if ( input != null )
|
||||
input.getHost().notifyNeighbors();
|
||||
}
|
||||
@@ -273,19 +273,19 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return getDestination().getSizeInventory();
|
||||
return this.getDestination().getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i)
|
||||
{
|
||||
return getDestination().getStackInSlot( i );
|
||||
return this.getDestination().getStackInSlot( i );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j)
|
||||
{
|
||||
return getDestination().decrStackSize( i, j );
|
||||
return this.getDestination().decrStackSize( i, j );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -297,7 +297,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack)
|
||||
{
|
||||
getDestination().setInventorySlotContents( i, itemstack );
|
||||
this.getDestination().setInventorySlotContents( i, itemstack );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -315,7 +315,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return getDestination().getInventoryStackLimit();
|
||||
return this.getDestination().getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -331,14 +331,14 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, net.minecraft.item.ItemStack itemstack)
|
||||
{
|
||||
return getDestination().isItemValidForSlot( i, itemstack );
|
||||
return this.getDestination().isItemValidForSlot( i, itemstack );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int var1)
|
||||
{
|
||||
int[] slots = new int[getSizeInventory()];
|
||||
for (int x = 0; x < getSizeInventory(); x++)
|
||||
int[] slots = new int[this.getSizeInventory()];
|
||||
for (int x = 0; x < this.getSizeInventory(); x++)
|
||||
slots[x] = x;
|
||||
return slots;
|
||||
}
|
||||
@@ -351,7 +351,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemstack, int j)
|
||||
{
|
||||
return getDestination().isItemValidForSlot( i, itemstack );
|
||||
return this.getDestination().isItemValidForSlot( i, itemstack );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -370,7 +370,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
@Method(iname = "BC")
|
||||
public ConnectOverride overridePipeConnection(PipeType type, ForgeDirection with)
|
||||
{
|
||||
return side.equals( with ) && type == PipeType.ITEM ? ConnectOverride.CONNECT : ConnectOverride.DEFAULT;
|
||||
return this.side.equals( with ) && type == PipeType.ITEM ? ConnectOverride.CONNECT : ConnectOverride.DEFAULT;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -58,82 +58,82 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
|
||||
|
||||
public void setLightLevel(int out)
|
||||
{
|
||||
lastValue = out;
|
||||
getHost().markForUpdate();
|
||||
this.lastValue = out;
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightLevel()
|
||||
{
|
||||
if ( output && isPowered() )
|
||||
return blockLight( lastValue );
|
||||
if ( this.output && this.isPowered() )
|
||||
return this.blockLight( this.lastValue );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int blockLight(int emit)
|
||||
{
|
||||
if ( opacity < 0 )
|
||||
if ( this.opacity < 0 )
|
||||
{
|
||||
TileEntity te = this.getTile();
|
||||
opacity = 255 - te.getWorldObj().getBlockLightOpacity( te.xCoord + side.offsetX, te.yCoord + side.offsetY, te.zCoord + side.offsetZ );
|
||||
this.opacity = 255 - te.getWorldObj().getBlockLightOpacity( te.xCoord + this.side.offsetX, te.yCoord + this.side.offsetY, te.zCoord + this.side.offsetZ );
|
||||
}
|
||||
|
||||
return (int) (emit * (opacity / 255.0f));
|
||||
return (int) (emit * (this.opacity / 255.0f));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void chanRender(MENetworkChannelsChanged c)
|
||||
{
|
||||
onTunnelNetworkChange();
|
||||
this.onTunnelNetworkChange();
|
||||
super.chanRender( c );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void powerRender(MENetworkPowerStatusChange c)
|
||||
{
|
||||
onTunnelNetworkChange();
|
||||
this.onTunnelNetworkChange();
|
||||
super.powerRender( c );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTunnelNetworkChange()
|
||||
{
|
||||
if ( output )
|
||||
if ( this.output )
|
||||
{
|
||||
PartP2PLight src = getInput();
|
||||
PartP2PLight src = this.getInput();
|
||||
if ( src != null && src.proxy.isActive() )
|
||||
setLightLevel( src.lastValue );
|
||||
this.setLightLevel( src.lastValue );
|
||||
else
|
||||
getHost().markForUpdate();
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
else
|
||||
doWork();
|
||||
this.doWork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTunnelConfigChange()
|
||||
{
|
||||
onTunnelNetworkChange();
|
||||
this.onTunnelNetworkChange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChanged()
|
||||
{
|
||||
opacity = -1;
|
||||
this.opacity = -1;
|
||||
|
||||
doWork();
|
||||
this.doWork();
|
||||
|
||||
if ( output )
|
||||
getHost().markForUpdate();
|
||||
if ( this.output )
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT( tag );
|
||||
tag.setFloat( "opacity", opacity );
|
||||
tag.setInteger( "lastValue", lastValue );
|
||||
tag.setFloat( "opacity", this.opacity );
|
||||
tag.setInteger( "lastValue", this.lastValue );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -141,16 +141,16 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
|
||||
{
|
||||
super.readFromNBT( tag );
|
||||
if ( tag.hasKey( "opacity" ) )
|
||||
opacity = tag.getFloat( "opacity" );
|
||||
lastValue = tag.getInteger( "lastValue" );
|
||||
this.opacity = tag.getFloat( "opacity" );
|
||||
this.lastValue = tag.getInteger( "lastValue" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean readFromStream(ByteBuf data) throws IOException
|
||||
{
|
||||
super.readFromStream( data );
|
||||
lastValue = data.readInt();
|
||||
output = lastValue > 0;
|
||||
this.lastValue = data.readInt();
|
||||
this.output = this.lastValue > 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
|
||||
public void writeToStream(ByteBuf data) throws IOException
|
||||
{
|
||||
super.writeToStream( data );
|
||||
data.writeInt( output ? lastValue : 0 );
|
||||
data.writeInt( this.output ? this.lastValue : 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -176,21 +176,21 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
|
||||
|
||||
private boolean doWork()
|
||||
{
|
||||
if ( output )
|
||||
if ( this.output )
|
||||
return false;
|
||||
|
||||
TileEntity te = getTile();
|
||||
TileEntity te = this.getTile();
|
||||
World w = te.getWorldObj();
|
||||
|
||||
int newLevel = w.getBlockLightValue( te.xCoord + side.offsetX, te.yCoord + side.offsetY, te.zCoord + side.offsetZ );
|
||||
int newLevel = w.getBlockLightValue( te.xCoord + this.side.offsetX, te.yCoord + this.side.offsetY, te.zCoord + this.side.offsetZ );
|
||||
|
||||
if ( lastValue != newLevel && proxy.isActive() )
|
||||
if ( this.lastValue != newLevel && this.proxy.isActive() )
|
||||
{
|
||||
lastValue = newLevel;
|
||||
this.lastValue = newLevel;
|
||||
try
|
||||
{
|
||||
for (PartP2PLight out : getOutputs())
|
||||
out.setLightLevel( lastValue );
|
||||
for (PartP2PLight out : this.getOutputs())
|
||||
out.setLightLevel( this.lastValue );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
@@ -209,6 +209,6 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
|
||||
@Override
|
||||
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
|
||||
{
|
||||
return doWork() ? TickRateModulation.FASTER : TickRateModulation.SLOWER;
|
||||
return this.doWork() ? TickRateModulation.FASTER : TickRateModulation.SLOWER;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,9 +55,9 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
|
||||
private FluidTankInfo[] getTank()
|
||||
{
|
||||
if ( output )
|
||||
if ( this.output )
|
||||
{
|
||||
PartP2PLiquids tun = getInput();
|
||||
PartP2PLiquids tun = this.getInput();
|
||||
if ( tun != null )
|
||||
return activeTank;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( !getOutputs().isEmpty() )
|
||||
if ( !this.getOutputs().isEmpty() )
|
||||
return activeTank;
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
@@ -98,7 +98,7 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
|
||||
try
|
||||
{
|
||||
for (PartP2PLiquids l : getOutputs())
|
||||
for (PartP2PLiquids l : this.getOutputs())
|
||||
{
|
||||
IFluidHandler handler = l.getTarget();
|
||||
if ( handler != null )
|
||||
@@ -119,10 +119,10 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
@Override
|
||||
public void onNeighborChanged()
|
||||
{
|
||||
cachedTank = null;
|
||||
if ( output )
|
||||
this.cachedTank = null;
|
||||
if ( this.output )
|
||||
{
|
||||
PartP2PLiquids in = getInput();
|
||||
PartP2PLiquids in = this.getInput();
|
||||
if ( in != null )
|
||||
in.onTunnelNetworkChange();
|
||||
}
|
||||
@@ -131,20 +131,20 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
@Override
|
||||
public void onTunnelNetworkChange()
|
||||
{
|
||||
cachedTank = null;
|
||||
this.cachedTank = null;
|
||||
}
|
||||
|
||||
IFluidHandler getTarget()
|
||||
{
|
||||
if ( !proxy.isActive() )
|
||||
if ( !this.proxy.isActive() )
|
||||
return null;
|
||||
|
||||
if ( cachedTank != null )
|
||||
return cachedTank;
|
||||
if ( this.cachedTank != null )
|
||||
return this.cachedTank;
|
||||
|
||||
TileEntity te = tile.getWorldObj().getTileEntity( tile.xCoord + side.offsetX, tile.yCoord + side.offsetY, tile.zCoord + side.offsetZ );
|
||||
TileEntity te = this.tile.getWorldObj().getTileEntity( this.tile.xCoord + this.side.offsetX, this.tile.yCoord + this.side.offsetY, this.tile.zCoord + this.side.offsetZ );
|
||||
if ( te instanceof IFluidHandler )
|
||||
return cachedTank = (IFluidHandler) te;
|
||||
return this.cachedTank = (IFluidHandler) te;
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -164,7 +164,7 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
Stack<PartP2PLiquids> stack = getDepth();
|
||||
Stack<PartP2PLiquids> stack = this.getDepth();
|
||||
|
||||
for (PartP2PLiquids t : stack)
|
||||
if ( t == this )
|
||||
@@ -172,7 +172,7 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
|
||||
stack.push( this );
|
||||
|
||||
List<PartP2PLiquids> list = getOutputs( resource.getFluid() );
|
||||
List<PartP2PLiquids> list = this.getOutputs( resource.getFluid() );
|
||||
int requestTotal = 0;
|
||||
|
||||
Iterator<PartP2PLiquids> i = list.iterator();
|
||||
@@ -239,7 +239,7 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
return !output && from.equals( side ) && !getOutputs( fluid ).isEmpty();
|
||||
return !this.output && from.equals( this.side ) && !this.getOutputs( fluid ).isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -263,8 +263,8 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from)
|
||||
{
|
||||
if ( from.equals( side ) )
|
||||
return getTank();
|
||||
if ( from.equals( this.side ) )
|
||||
return this.getTank();
|
||||
return new FluidTankInfo[0];
|
||||
}
|
||||
|
||||
|
||||
@@ -59,46 +59,46 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
|
||||
@Override
|
||||
public int isProvidingStrongPower()
|
||||
{
|
||||
return output ? power : 0;
|
||||
return this.output ? this.power : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingWeakPower()
|
||||
{
|
||||
return output ? power : 0;
|
||||
return this.output ? this.power : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTunnelNetworkChange()
|
||||
{
|
||||
setNetworkReady();
|
||||
this.setNetworkReady();
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void changeStateA(MENetworkBootingStatusChange bs)
|
||||
{
|
||||
setNetworkReady();
|
||||
this.setNetworkReady();
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void changeStateB(MENetworkChannelsChanged bs)
|
||||
{
|
||||
setNetworkReady();
|
||||
this.setNetworkReady();
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void changeStateC(MENetworkPowerStatusChange bs)
|
||||
{
|
||||
setNetworkReady();
|
||||
this.setNetworkReady();
|
||||
}
|
||||
|
||||
public void setNetworkReady()
|
||||
{
|
||||
if ( output )
|
||||
if ( this.output )
|
||||
{
|
||||
PartP2PRedstone in = getInput();
|
||||
PartP2PRedstone in = this.getInput();
|
||||
if ( in != null )
|
||||
putInput( in.power );
|
||||
this.putInput( in.power );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,30 +106,30 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
|
||||
|
||||
protected void putInput(Object o)
|
||||
{
|
||||
if ( recursive )
|
||||
if ( this.recursive )
|
||||
return;
|
||||
|
||||
recursive = true;
|
||||
if ( output && proxy.isActive() )
|
||||
this.recursive = true;
|
||||
if ( this.output && this.proxy.isActive() )
|
||||
{
|
||||
int newPower = (Integer) o;
|
||||
if ( power != newPower )
|
||||
if ( this.power != newPower )
|
||||
{
|
||||
power = newPower;
|
||||
notifyNeighbors();
|
||||
this.power = newPower;
|
||||
this.notifyNeighbors();
|
||||
}
|
||||
}
|
||||
recursive = false;
|
||||
this.recursive = false;
|
||||
|
||||
}
|
||||
|
||||
public void notifyNeighbors()
|
||||
{
|
||||
World worldObj = tile.getWorldObj();
|
||||
World worldObj = this.tile.getWorldObj();
|
||||
|
||||
int xCoord = tile.xCoord;
|
||||
int yCoord = tile.yCoord;
|
||||
int zCoord = tile.zCoord;
|
||||
int xCoord = this.tile.xCoord;
|
||||
int yCoord = this.tile.yCoord;
|
||||
int zCoord = this.tile.zCoord;
|
||||
|
||||
Platform.notifyBlocksOfNeighbors( worldObj, xCoord, yCoord, zCoord );
|
||||
|
||||
@@ -146,14 +146,14 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT( tag );
|
||||
tag.setInteger( "power", power );
|
||||
tag.setInteger( "power", this.power );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readFromNBT( tag );
|
||||
power = tag.getInteger( "power" );
|
||||
this.power = tag.getInteger( "power" );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -171,24 +171,24 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
|
||||
@Override
|
||||
public void onNeighborChanged()
|
||||
{
|
||||
if ( !output )
|
||||
if ( !this.output )
|
||||
{
|
||||
int x = tile.xCoord + side.offsetX;
|
||||
int y = tile.yCoord + side.offsetY;
|
||||
int z = tile.zCoord + side.offsetZ;
|
||||
int x = this.tile.xCoord + this.side.offsetX;
|
||||
int y = this.tile.yCoord + this.side.offsetY;
|
||||
int z = this.tile.zCoord + this.side.offsetZ;
|
||||
|
||||
Block b = tile.getWorldObj().getBlock( x, y, z );
|
||||
if ( b != null && !output )
|
||||
Block b = this.tile.getWorldObj().getBlock( x, y, z );
|
||||
if ( b != null && !this.output )
|
||||
{
|
||||
int srcSide = side.ordinal();
|
||||
int srcSide = this.side.ordinal();
|
||||
if ( b instanceof BlockRedstoneWire )
|
||||
srcSide = 1;
|
||||
power = b.isProvidingStrongPower( tile.getWorldObj(), x, y, z, srcSide );
|
||||
power = Math.max( power, b.isProvidingWeakPower( tile.getWorldObj(), x, y, z, srcSide ) );
|
||||
sendToOutput( power );
|
||||
this.power = b.isProvidingStrongPower( this.tile.getWorldObj(), x, y, z, srcSide );
|
||||
this.power = Math.max( this.power, b.isProvidingWeakPower( this.tile.getWorldObj(), x, y, z, srcSide ) );
|
||||
this.sendToOutput( this.power );
|
||||
}
|
||||
else
|
||||
sendToOutput( 0 );
|
||||
this.sendToOutput( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
|
||||
{
|
||||
try
|
||||
{
|
||||
for (PartP2PRedstone rs : getOutputs())
|
||||
for (PartP2PRedstone rs : this.getOutputs())
|
||||
{
|
||||
rs.putInput( power );
|
||||
}
|
||||
|
||||
@@ -55,11 +55,11 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
|
||||
|
||||
public boolean output;
|
||||
public long freq;
|
||||
final TunnelCollection type = new TunnelCollection<T>( null, getClass() );
|
||||
final TunnelCollection type = new TunnelCollection<T>( null, this.getClass() );
|
||||
|
||||
public PartP2PTunnel(ItemStack is) {
|
||||
super( PartP2PTunnel.class, is );
|
||||
if ( getClass() == PartP2PTunnel.class )
|
||||
if ( this.getClass() == PartP2PTunnel.class )
|
||||
throw new RuntimeException( "Don't construct the root tunnel!" );
|
||||
}
|
||||
|
||||
@@ -72,15 +72,15 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound data)
|
||||
{
|
||||
data.setBoolean( "output", output );
|
||||
data.setLong( "freq", freq );
|
||||
data.setBoolean( "output", this.output );
|
||||
data.setLong( "freq", this.freq );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound data)
|
||||
{
|
||||
output = data.getBoolean( "output" );
|
||||
freq = data.getLong( "freq" );
|
||||
this.output = data.getBoolean( "output" );
|
||||
this.freq = data.getLong( "freq" );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -107,9 +107,9 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
|
||||
IPart testPart = ((IPartItem) newType.getItem()).createPartFromItemStack( newType );
|
||||
if ( testPart instanceof PartP2PTunnel )
|
||||
{
|
||||
getHost().removePart( side, true );
|
||||
ForgeDirection dir = getHost().addPart( newType, side, player );
|
||||
IPart newBus = getHost().getPart( dir );
|
||||
this.getHost().removePart( this.side, true );
|
||||
ForgeDirection dir = this.getHost().addPart( newType, this.side, player );
|
||||
IPart newBus = this.getHost().getPart( dir );
|
||||
|
||||
if ( newBus instanceof PartP2PTunnel )
|
||||
{
|
||||
@@ -181,12 +181,12 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
|
||||
|
||||
if ( newType != null && !Platform.isSameItem( newType, this.is ) )
|
||||
{
|
||||
boolean oldOutput = output;
|
||||
long myFreq = freq;
|
||||
boolean oldOutput = this.output;
|
||||
long myFreq = this.freq;
|
||||
|
||||
getHost().removePart( side, false );
|
||||
ForgeDirection dir = getHost().addPart( newType, side, player );
|
||||
IPart newBus = getHost().getPart( dir );
|
||||
this.getHost().removePart( this.side, false );
|
||||
ForgeDirection dir = this.getHost().addPart( newType, this.side, player );
|
||||
IPart newBus = this.getHost().getPart( dir );
|
||||
|
||||
if ( newBus instanceof PartP2PTunnel )
|
||||
{
|
||||
@@ -205,7 +205,7 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
|
||||
}
|
||||
}
|
||||
|
||||
Platform.notifyBlocksOfNeighbors( tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord );
|
||||
Platform.notifyBlocksOfNeighbors( this.tile.getWorldObj(), this.tile.xCoord, this.tile.yCoord, this.tile.zCoord );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -227,29 +227,29 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
|
||||
IMemoryCard mc = (IMemoryCard) is.getItem();
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
long newFreq = freq;
|
||||
boolean wasOutput = output;
|
||||
output = false;
|
||||
long newFreq = this.freq;
|
||||
boolean wasOutput = this.output;
|
||||
this.output = false;
|
||||
|
||||
if ( wasOutput || freq == 0 )
|
||||
if ( wasOutput || this.freq == 0 )
|
||||
newFreq = System.currentTimeMillis();
|
||||
|
||||
try
|
||||
{
|
||||
proxy.getP2P().updateFreq( this, newFreq );
|
||||
this.proxy.getP2P().updateFreq( this, newFreq );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
// :P
|
||||
}
|
||||
|
||||
onTunnelConfigChange();
|
||||
this.onTunnelConfigChange();
|
||||
|
||||
ItemStack p2pItem = getItemStack( PartItemStack.Wrench );
|
||||
ItemStack p2pItem = this.getItemStack( PartItemStack.Wrench );
|
||||
String type = p2pItem.getUnlocalizedName();
|
||||
|
||||
p2pItem.writeToNBT( data );
|
||||
data.setLong( "freq", freq );
|
||||
data.setLong( "freq", this.freq );
|
||||
|
||||
mc.setMemoryCardContents( is, type + ".name", data );
|
||||
mc.notifyUser( player, MemoryCardMessages.SETTINGS_SAVED );
|
||||
@@ -273,10 +273,10 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
|
||||
|
||||
public TunnelCollection<T> getCollection(Collection<PartP2PTunnel> collection, Class<? extends PartP2PTunnel> c)
|
||||
{
|
||||
if ( type.matches( c ) )
|
||||
if ( this.type.matches( c ) )
|
||||
{
|
||||
type.setSource( collection );
|
||||
return type;
|
||||
this.type.setSource( collection );
|
||||
return this.type;
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -284,14 +284,14 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
|
||||
|
||||
public T getInput()
|
||||
{
|
||||
if ( freq == 0 )
|
||||
if ( this.freq == 0 )
|
||||
return null;
|
||||
|
||||
PartP2PTunnel tunnel;
|
||||
try
|
||||
{
|
||||
tunnel = proxy.getP2P().getInput( freq );
|
||||
if ( getClass().isInstance( tunnel ) )
|
||||
tunnel = this.proxy.getP2P().getInput( this.freq );
|
||||
if ( this.getClass().isInstance( tunnel ) )
|
||||
return (T) tunnel;
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
@@ -303,9 +303,9 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
|
||||
|
||||
public TunnelCollection<T> getOutputs() throws GridAccessException
|
||||
{
|
||||
if ( proxy.isActive() )
|
||||
return (TunnelCollection<T>) proxy.getP2P().getOutputs( freq, getClass() );
|
||||
return new TunnelCollection( new ArrayList(), getClass() );
|
||||
if ( this.proxy.isActive() )
|
||||
return (TunnelCollection<T>) this.proxy.getP2P().getOutputs( this.freq, this.getClass() );
|
||||
return new TunnelCollection( new ArrayList(), this.getClass() );
|
||||
}
|
||||
|
||||
public void onTunnelNetworkChange()
|
||||
@@ -317,13 +317,13 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderInventory(IPartRenderHelper rh, RenderBlocks renderer)
|
||||
{
|
||||
rh.setTexture( getTypeTexture() );
|
||||
rh.setTexture( this.getTypeTexture() );
|
||||
|
||||
rh.setBounds( 2, 2, 14, 14, 14, 16 );
|
||||
rh.renderInventoryBox( renderer );
|
||||
|
||||
rh.setTexture( CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.BlockP2PTunnel2.getIcon(),
|
||||
is.getIconIndex(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon() );
|
||||
this.is.getIconIndex(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon() );
|
||||
|
||||
rh.setBounds( 2, 2, 14, 14, 14, 16 );
|
||||
rh.renderInventoryBox( renderer );
|
||||
@@ -338,14 +338,14 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer)
|
||||
{
|
||||
renderCache = rh.useSimplifiedRendering( x, y, z, this, renderCache );
|
||||
rh.setTexture( getTypeTexture() );
|
||||
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
|
||||
rh.setTexture( this.getTypeTexture() );
|
||||
|
||||
rh.setBounds( 2, 2, 14, 14, 14, 16 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
|
||||
rh.setTexture( CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.BlockP2PTunnel2.getIcon(),
|
||||
is.getIconIndex(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon() );
|
||||
this.is.getIconIndex(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon() );
|
||||
|
||||
rh.setBounds( 2, 2, 14, 14, 14, 16 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
@@ -361,7 +361,7 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
|
||||
rh.setBounds( 5, 6, 12, 11, 10, 13 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
|
||||
renderLights( x, y, z, rh, renderer );
|
||||
this.renderLights( x, y, z, rh, renderer );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -377,7 +377,7 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
|
||||
|
||||
try
|
||||
{
|
||||
proxy.getEnergy().extractAEPower( ae_to_tax, Actionable.MODULATE, PowerMultiplier.ONE );
|
||||
this.proxy.getEnergy().extractAEPower( ae_to_tax, Actionable.MODULATE, PowerMultiplier.ONE );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
|
||||
@@ -59,49 +59,49 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||
|
||||
public PartP2PTunnelME(ItemStack is) {
|
||||
super( is );
|
||||
proxy.setFlags( GridFlags.REQUIRE_CHANNEL, GridFlags.COMPRESSED_CHANNEL );
|
||||
outerProxy.setFlags( GridFlags.DENSE_CAPACITY, GridFlags.CANNOT_CARRY_COMPRESSED );
|
||||
this.proxy.setFlags( GridFlags.REQUIRE_CHANNEL, GridFlags.COMPRESSED_CHANNEL );
|
||||
this.outerProxy.setFlags( GridFlags.DENSE_CAPACITY, GridFlags.CANNOT_CARRY_COMPRESSED );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPartHostInfo(ForgeDirection side, IPartHost host, TileEntity tile)
|
||||
{
|
||||
super.setPartHostInfo( side, host, tile );
|
||||
outerProxy.setValidSides( EnumSet.of( side ) );
|
||||
this.outerProxy.setValidSides( EnumSet.of( side ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound extra)
|
||||
{
|
||||
super.readFromNBT( extra );
|
||||
outerProxy.readFromNBT( extra );
|
||||
this.outerProxy.readFromNBT( extra );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound extra)
|
||||
{
|
||||
super.writeToNBT( extra );
|
||||
outerProxy.writeToNBT( extra );
|
||||
this.outerProxy.writeToNBT( extra );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addToWorld()
|
||||
{
|
||||
super.addToWorld();
|
||||
outerProxy.onReady();
|
||||
this.outerProxy.onReady();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFromWorld()
|
||||
{
|
||||
super.removeFromWorld();
|
||||
outerProxy.invalidate();
|
||||
this.outerProxy.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridNode getExternalFacingNode()
|
||||
{
|
||||
return outerProxy.getNode();
|
||||
return this.outerProxy.getNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -114,11 +114,11 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||
public void onTunnelNetworkChange()
|
||||
{
|
||||
super.onTunnelNetworkChange();
|
||||
if ( !output )
|
||||
if ( !this.output )
|
||||
{
|
||||
try
|
||||
{
|
||||
proxy.getTick().wakeDevice( proxy.getNode() );
|
||||
this.proxy.getTick().wakeDevice( this.proxy.getNode() );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
@@ -139,24 +139,24 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||
// just move on...
|
||||
try
|
||||
{
|
||||
if ( !proxy.getPath().isNetworkBooting() )
|
||||
if ( !this.proxy.getPath().isNetworkBooting() )
|
||||
{
|
||||
if ( !proxy.getEnergy().isNetworkPowered() )
|
||||
if ( !this.proxy.getEnergy().isNetworkPowered() )
|
||||
{
|
||||
connection.markDestroy();
|
||||
TickHandler.instance.addCallable( tile.getWorldObj(), connection );
|
||||
this.connection.markDestroy();
|
||||
TickHandler.instance.addCallable( this.tile.getWorldObj(), this.connection );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( proxy.isActive() )
|
||||
if ( this.proxy.isActive() )
|
||||
{
|
||||
connection.markCreate();
|
||||
TickHandler.instance.addCallable( tile.getWorldObj(), connection );
|
||||
this.connection.markCreate();
|
||||
TickHandler.instance.addCallable( this.tile.getWorldObj(), this.connection );
|
||||
}
|
||||
else
|
||||
{
|
||||
connection.markDestroy();
|
||||
TickHandler.instance.addCallable( tile.getWorldObj(), connection );
|
||||
this.connection.markDestroy();
|
||||
TickHandler.instance.addCallable( this.tile.getWorldObj(), this.connection );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,28 +175,28 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||
public void onPlacement(EntityPlayer player, ItemStack held, ForgeDirection side)
|
||||
{
|
||||
super.onPlacement( player, held, side );
|
||||
outerProxy.setOwner( player );
|
||||
this.outerProxy.setOwner( player );
|
||||
}
|
||||
|
||||
public void updateConnections(Connections connections)
|
||||
{
|
||||
if ( connections.destroy )
|
||||
{
|
||||
for (TunnelConnection cw : connection.connections.values())
|
||||
for (TunnelConnection cw : this.connection.connections.values())
|
||||
cw.c.destroy();
|
||||
|
||||
connection.connections.clear();
|
||||
this.connection.connections.clear();
|
||||
}
|
||||
else if ( connections.create )
|
||||
{
|
||||
|
||||
Iterator<TunnelConnection> i = connection.connections.values().iterator();
|
||||
Iterator<TunnelConnection> i = this.connection.connections.values().iterator();
|
||||
while (i.hasNext())
|
||||
{
|
||||
TunnelConnection cw = i.next();
|
||||
try
|
||||
{
|
||||
if ( cw.tunnel.proxy.getGrid() != proxy.getGrid() )
|
||||
if ( cw.tunnel.proxy.getGrid() != this.proxy.getGrid() )
|
||||
{
|
||||
cw.c.destroy();
|
||||
i.remove();
|
||||
@@ -216,7 +216,7 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||
LinkedList<PartP2PTunnelME> newSides = new LinkedList<PartP2PTunnelME>();
|
||||
try
|
||||
{
|
||||
for (PartP2PTunnelME me : getOutputs())
|
||||
for (PartP2PTunnelME me : this.getOutputs())
|
||||
{
|
||||
if ( me.proxy.isActive() && connections.connections.get( me.getGridNode() ) == null )
|
||||
{
|
||||
@@ -229,7 +229,7 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||
try
|
||||
{
|
||||
connections.connections.put( me.getGridNode(),
|
||||
new TunnelConnection( me, AEApi.instance().createGridConnection( outerProxy.getNode(), me.outerProxy.getNode() ) ) );
|
||||
new TunnelConnection( me, AEApi.instance().createGridConnection( this.outerProxy.getNode(), me.outerProxy.getNode() ) ) );
|
||||
}
|
||||
catch (FailedConnection e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user