Merge pull request #761 from yueh/fix-760
Improved the logged warning for FailledConnection
This commit is contained in:
commit
3d2bd84450
1 changed files with 24 additions and 19 deletions
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package appeng.parts.p2p;
|
package appeng.parts.p2p;
|
||||||
|
|
||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
@ -46,6 +47,7 @@ import appeng.me.cache.helpers.Connections;
|
||||||
import appeng.me.cache.helpers.TunnelConnection;
|
import appeng.me.cache.helpers.TunnelConnection;
|
||||||
import appeng.me.helpers.AENetworkProxy;
|
import appeng.me.helpers.AENetworkProxy;
|
||||||
|
|
||||||
|
|
||||||
public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements IGridTickable
|
public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements IGridTickable
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -58,28 +60,29 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||||
final AENetworkProxy outerProxy = new AENetworkProxy( this, "outer", null, true );
|
final AENetworkProxy outerProxy = new AENetworkProxy( this, "outer", null, true );
|
||||||
public final Connections connection = new Connections( this );
|
public final Connections connection = new Connections( this );
|
||||||
|
|
||||||
public PartP2PTunnelME(ItemStack is) {
|
public PartP2PTunnelME( ItemStack is )
|
||||||
|
{
|
||||||
super( is );
|
super( is );
|
||||||
this.proxy.setFlags( GridFlags.REQUIRE_CHANNEL, GridFlags.COMPRESSED_CHANNEL );
|
this.proxy.setFlags( GridFlags.REQUIRE_CHANNEL, GridFlags.COMPRESSED_CHANNEL );
|
||||||
this.outerProxy.setFlags( GridFlags.DENSE_CAPACITY, GridFlags.CANNOT_CARRY_COMPRESSED );
|
this.outerProxy.setFlags( GridFlags.DENSE_CAPACITY, GridFlags.CANNOT_CARRY_COMPRESSED );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPartHostInfo(ForgeDirection side, IPartHost host, TileEntity tile)
|
public void setPartHostInfo( ForgeDirection side, IPartHost host, TileEntity tile )
|
||||||
{
|
{
|
||||||
super.setPartHostInfo( side, host, tile );
|
super.setPartHostInfo( side, host, tile );
|
||||||
this.outerProxy.setValidSides( EnumSet.of( side ) );
|
this.outerProxy.setValidSides( EnumSet.of( side ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound extra)
|
public void readFromNBT( NBTTagCompound extra )
|
||||||
{
|
{
|
||||||
super.readFromNBT( extra );
|
super.readFromNBT( extra );
|
||||||
this.outerProxy.readFromNBT( extra );
|
this.outerProxy.readFromNBT( extra );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToNBT(NBTTagCompound extra)
|
public void writeToNBT( NBTTagCompound extra )
|
||||||
{
|
{
|
||||||
super.writeToNBT( extra );
|
super.writeToNBT( extra );
|
||||||
this.outerProxy.writeToNBT( extra );
|
this.outerProxy.writeToNBT( extra );
|
||||||
|
@ -106,7 +109,7 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AECableType getCableConnectionType(ForgeDirection dir)
|
public AECableType getCableConnectionType( ForgeDirection dir )
|
||||||
{
|
{
|
||||||
return AECableType.DENSE;
|
return AECableType.DENSE;
|
||||||
}
|
}
|
||||||
|
@ -121,7 +124,7 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||||
{
|
{
|
||||||
this.proxy.getTick().wakeDevice( this.proxy.getNode() );
|
this.proxy.getTick().wakeDevice( this.proxy.getNode() );
|
||||||
}
|
}
|
||||||
catch (GridAccessException e)
|
catch ( GridAccessException e )
|
||||||
{
|
{
|
||||||
// :P
|
// :P
|
||||||
}
|
}
|
||||||
|
@ -129,13 +132,13 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TickingRequest getTickingRequest(IGridNode node)
|
public TickingRequest getTickingRequest( IGridNode node )
|
||||||
{
|
{
|
||||||
return new TickingRequest( TickRates.METunnel.min, TickRates.METunnel.max, true, false );
|
return new TickingRequest( TickRates.METunnel.min, TickRates.METunnel.max, true, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
|
public TickRateModulation tickingRequest( IGridNode node, int TicksSinceLastCall )
|
||||||
{
|
{
|
||||||
// just move on...
|
// just move on...
|
||||||
try
|
try
|
||||||
|
@ -164,7 +167,7 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||||
return TickRateModulation.SLEEP;
|
return TickRateModulation.SLEEP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (GridAccessException e)
|
catch ( GridAccessException e )
|
||||||
{
|
{
|
||||||
// meh?
|
// meh?
|
||||||
}
|
}
|
||||||
|
@ -173,17 +176,17 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlacement(EntityPlayer player, ItemStack held, ForgeDirection side)
|
public void onPlacement( EntityPlayer player, ItemStack held, ForgeDirection side )
|
||||||
{
|
{
|
||||||
super.onPlacement( player, held, side );
|
super.onPlacement( player, held, side );
|
||||||
this.outerProxy.setOwner( player );
|
this.outerProxy.setOwner( player );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateConnections(Connections connections)
|
public void updateConnections( Connections connections )
|
||||||
{
|
{
|
||||||
if ( connections.destroy )
|
if ( connections.destroy )
|
||||||
{
|
{
|
||||||
for (TunnelConnection cw : this.connection.connections.values())
|
for ( TunnelConnection cw : this.connection.connections.values() )
|
||||||
cw.c.destroy();
|
cw.c.destroy();
|
||||||
|
|
||||||
this.connection.connections.clear();
|
this.connection.connections.clear();
|
||||||
|
@ -192,7 +195,7 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||||
{
|
{
|
||||||
|
|
||||||
Iterator<TunnelConnection> i = this.connection.connections.values().iterator();
|
Iterator<TunnelConnection> i = this.connection.connections.values().iterator();
|
||||||
while (i.hasNext())
|
while ( i.hasNext() )
|
||||||
{
|
{
|
||||||
TunnelConnection cw = i.next();
|
TunnelConnection cw = i.next();
|
||||||
try
|
try
|
||||||
|
@ -208,7 +211,7 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||||
i.remove();
|
i.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (GridAccessException e)
|
catch ( GridAccessException e )
|
||||||
{
|
{
|
||||||
// :P
|
// :P
|
||||||
}
|
}
|
||||||
|
@ -217,7 +220,7 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||||
LinkedList<PartP2PTunnelME> newSides = new LinkedList<PartP2PTunnelME>();
|
LinkedList<PartP2PTunnelME> newSides = new LinkedList<PartP2PTunnelME>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for (PartP2PTunnelME me : this.getOutputs())
|
for ( PartP2PTunnelME me : this.getOutputs() )
|
||||||
{
|
{
|
||||||
if ( me.proxy.isActive() && connections.connections.get( me.getGridNode() ) == null )
|
if ( me.proxy.isActive() && connections.connections.get( me.getGridNode() ) == null )
|
||||||
{
|
{
|
||||||
|
@ -225,21 +228,23 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (PartP2PTunnelME me : newSides)
|
for ( PartP2PTunnelME me : newSides )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
connections.connections.put( me.getGridNode(),
|
connections.connections.put( me.getGridNode(),
|
||||||
new TunnelConnection( me, AEApi.instance().createGridConnection( this.outerProxy.getNode(), me.outerProxy.getNode() ) ) );
|
new TunnelConnection( me, AEApi.instance().createGridConnection( this.outerProxy.getNode(), me.outerProxy.getNode() ) ) );
|
||||||
}
|
}
|
||||||
catch (FailedConnection e)
|
catch ( FailedConnection e )
|
||||||
{
|
{
|
||||||
AELog.error( e );
|
final TileEntity start = this.getTile();
|
||||||
|
final TileEntity end = me.getTile();
|
||||||
|
AELog.warning( "Failed to establish a ME P2P Tunnel between the tunnels at [x=%d, y=%d, z=%d] and [x=%d, y=%d, z=%d]", start.xCoord, start.yCoord, start.zCoord, end.xCoord, end.yCoord, end.zCoord );
|
||||||
// :(
|
// :(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (GridAccessException e)
|
catch ( GridAccessException e )
|
||||||
{
|
{
|
||||||
AELog.error( e );
|
AELog.error( e );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue