Fixes #2566: Update packet deserialization was broken when parts were present that were not a grid host.
This commit is contained in:
parent
32a0496bc2
commit
e67969f52f
|
@ -290,27 +290,28 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||||
boolean[] writeSide = new boolean[EnumFacing.values().length];
|
boolean[] writeSide = new boolean[EnumFacing.values().length];
|
||||||
int[] channelsPerSide = new int[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();
|
IGridNode n = this.getGridNode();
|
||||||
if( n != null )
|
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() )
|
for( final IGridConnection gc : n.getConnections() )
|
||||||
{
|
{
|
||||||
final AEPartLocation side = gc.getDirection( n );
|
final AEPartLocation side = gc.getDirection( n );
|
||||||
|
|
Loading…
Reference in a new issue