Fixes #2566: Update packet deserialization was broken when parts were present that were not a grid host.

This commit is contained in:
Sebastian Hartte 2016-11-07 00:44:53 +01:00
parent 32a0496bc2
commit e67969f52f
1 changed files with 19 additions and 18 deletions

View File

@ -290,27 +290,28 @@ public class PartCable extends AEBasePart implements IPartCable
boolean[] writeSide = new boolean[EnumFacing.values().length];
int[] channelsPerSide = new int[EnumFacing.values().length];
for( EnumFacing thisSide : EnumFacing.values() )
{
final IPart part = this.getHost().getPart( thisSide );
if( part != null )
{
writeSide[thisSide.ordinal()] = true;
int channels = 0;
if( part.getGridNode() != null )
{
final IReadOnlyCollection<IGridConnection> set = part.getGridNode().getConnections();
for( final IGridConnection gc : set )
{
channels = Math.max( channels, gc.getUsedChannels() );
}
}
channelsPerSide[thisSide.ordinal()] = channels;
}
}
IGridNode n = this.getGridNode();
if( n != null )
{
for( EnumFacing thisSide : EnumFacing.values() )
{
final IPart part = this.getHost().getPart( thisSide );
if( part != null )
{
if( part.getGridNode() != null )
{
writeSide[thisSide.ordinal()] = true;
final IReadOnlyCollection<IGridConnection> set = part.getGridNode().getConnections();
for( final IGridConnection gc : set )
{
channelsPerSide[thisSide.ordinal()] = gc.getUsedChannels();
}
}
}
}
for( final IGridConnection gc : n.getConnections() )
{
final AEPartLocation side = gc.getDirection( n );