public void writeToStream(ByteBuf data) throws IOException
{
int cs = 0;
int sideOut = 0;
IGridNode n = getGridNode();
if ( n != null )
{
for (ForgeDirection thisSide : ForgeDirection.VALID_DIRECTIONS)
{
IPart part = getHost().getPart( thisSide );
if ( part != null )
{
if ( part.getGridNode() != null )
{
IReadOnlyCollection<IGridConnection> set = part.getGridNode().getConnections();
for (IGridConnection gc : set)
{
if ( proxy.getNode().hasFlag( GridFlags.DENSE_CAPACITY ) && gc.getOtherSide( proxy.getNode() ).hasFlag( GridFlags.DENSE_CAPACITY ) )
sideOut |= (gc.getUsedChannels() / 4) << (4 * thisSide.ordinal());
else
sideOut |= (gc.getUsedChannels()) << (4 * thisSide.ordinal());
}
}
}
}
for (IGridConnection gc : n.getConnections())
{
ForgeDirection side = gc.getDirection( n );
if ( side != ForgeDirection.UNKNOWN )
{
boolean isTier2a = proxy.getNode().hasFlag( GridFlags.DENSE_CAPACITY );