{
TileEntity te = world.getTileEntity( x, y, z );
if ( te instanceof IGridHost )
{
GridNode node = (GridNode) ((IGridHost) te).getGridNode( ForgeDirection.getOrientation( side ) );
if ( node != null )
{
Grid g = node.getInternalGrid();
IGridNode center = g.getPivot();
outputMsg( player, "This Node: " + node.toString() );
outputMsg( player, "Center Node: " + center.toString() );
IPathingGrid pg = g.getCache( IPathingGrid.class );
if ( pg.getControllerState() == ControllerState.CONTROLLER_ONLINE )
{
int length = 0;
HashSet<IGridNode> next = new HashSet<IGridNode>();
next.add( node );
int maxLength = 10000;
outer: while ( ! next.isEmpty() )
{
HashSet<IGridNode> current = next;
next = new HashSet<IGridNode>();
for ( IGridNode n : current )
{
if ( n.getMachine() instanceof TileController )
break outer;
for ( IGridConnection c : n.getConnections() )
next.add( c.getOtherSide( n ) );
}
length++;
if ( length > maxLength )
break;
}
outputMsg( player, "Cable Distance: " + length );
}
if ( center.getMachine() instanceof PartP2PTunnel )
{
outputMsg( player, "Freq: " + ((PartP2PTunnel) center.getMachine()).freq );
}
TickManagerCache tmc = g.getCache( ITickManager.class );
for (Class c : g.getMachineClasses())
{
int o = 0;
long nanos = 0;
for (IGridNode oj : g.getMachines( c ))
{
o++;
nanos += tmc.getAvgNanoTime( oj );
}
if ( nanos < 0 )
{
outputMsg( player, c.getSimpleName() + " - " + o );
}
else
{
outputMsg( player, c.getSimpleName() + " - " + o + "; " + timeMeasurement( nanos ) );
}
}
}
else
outputMsg( player, "No Node Available." );
}
else
outputMsg( player, "Not Networked Block" );
if ( te instanceof IPartHost )
{
IPart center = ((IPartHost) te).getPart( ForgeDirection.UNKNOWN );
((IPartHost) te).markForUpdate();
if ( center != null )
{
GridNode n = (GridNode) center.getGridNode();
outputMsg( player, "Node Channels: " + n.usedChannels() );
for (IGridConnection gc : n.getConnections())
{
ForgeDirection fd = gc.getDirection( n );
if ( fd != ForgeDirection.UNKNOWN )
outputMsg( player, fd.toString() + ": " + gc.getUsedChannels() );
}