private static boolean topWireConn(GatePart g, int r)
{
int absDir = Rotation.rotateSide(g.side(), r);
BlockCoord pos = new BlockCoord(g.tile()).offset(absDir);
TileMultipart t = PRLib.getMultipartTile(g.world(), pos);
if (t != null)
{
TMultiPart tp = t.partMap(g.side());
if (tp instanceof ITopArrayWire)
{
int a_r = ((GatePart) tp).rotation();
return (a_r & 1) == (g.rotation() & 1);
}