@Override
  public void updateEntity() {
    if (!loaded && hasWorldObj() && !worldObj.isRemote) {
      loaded = true;
      createAELink();
      for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
        TileEntity tileEntity =
            worldObj.getTileEntity(
                xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ);
        if (tileEntity instanceof IGridHost) {
          IGridNode node = ((IGridHost) tileEntity).getGridNode(direction);
          if (node != null) {
            node.updateState();
          }
        }

        for (ImmersiveNetHandler.Connection connection :
            ImmersiveNetHandler.INSTANCE.getConnections(worldObj, Utils.toCC(this))) {
          ChunkCoordinates opposite = connection.end;
          if (connection.end.equals(Utils.toCC(this))) {
            opposite = connection.start;
          }

          TileEntity teOpposite =
              worldObj.getTileEntity(opposite.posX, opposite.posY, opposite.posZ);
          if (teOpposite instanceof TileMEWireConnector) {
            GridNode nodeA =
                (GridNode) ((TileMEWireConnector) teOpposite).getGridNode(ForgeDirection.UNKNOWN);
            GridNode nodeB = (GridNode) getGridNode(ForgeDirection.UNKNOWN);
            if (!nodeA.hasConnection(nodeB) && !nodeB.hasConnection(nodeA)) {
              try {
                gridConnections.add(AEApi.instance().createGridConnection(nodeA, nodeB));
              } catch (FailedConnection failedConnection) {
                failedConnection.printStackTrace();
              }
            }
          }
        }
      }
    }
  }
 public void destroyAELink() {
   if (theGridNode != null) theGridNode.destroy();
 }
 public void createAELink() {
   if (!worldObj.isRemote) {
     if (theGridNode == null) theGridNode = AEApi.instance().createGridNode(this);
     theGridNode.updateState();
   }
 }